This commit is contained in:
lash 2025-01-21 15:28:55 +00:00
parent f7d31e4e81
commit d5e636fbd6
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
14 changed files with 82 additions and 81 deletions

View File

@ -25,7 +25,7 @@ func setLanguage() error {
defaultLanguage = env.GetEnv("DEFAULT_LANGUAGE", defaultLanguage)
languages = strings.Split(env.GetEnv("LANGUAGES", defaultLanguage), ",")
haveDefaultLanguage := false
for i, v := range(languages) {
for i, v := range languages {
languages[i] = strings.ReplaceAll(v, " ", "")
if languages[i] == defaultLanguage {
haveDefaultLanguage = true
@ -48,6 +48,7 @@ func setConn() error {
}
func ApplyConn(connStr *string, stateConnStr *string, resourceConnStr *string, userConnStr *string) {
logg.Infof("applyconn", "state", stateConnStr, "user", userConnStr)
if connStr != nil {
dbConn = *connStr
}

View File

@ -2,8 +2,9 @@ package entry
import (
"context"
"git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
)
type EntryHandler interface {

View File

@ -7,9 +7,9 @@ import (
"git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
"git.grassecon.net/grassrootseconomics/visedriver/errors"
"git.grassecon.net/grassrootseconomics/visedriver/entry"
"git.grassecon.net/grassrootseconomics/visedriver/errors"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
)
type BaseRequestHandler struct {

View File

@ -5,8 +5,8 @@ import (
"strconv"
"git.defalsify.org/vise.git/logging"
"git.grassecon.net/grassrootseconomics/visedriver/request"
"git.grassecon.net/grassrootseconomics/visedriver/errors"
"git.grassecon.net/grassrootseconomics/visedriver/request"
)
var (

View File

@ -10,8 +10,8 @@ import (
"git.defalsify.org/vise.git/engine"
viseerrors "git.grassecon.net/grassrootseconomics/visedriver/errors"
"git.grassecon.net/grassrootseconomics/visedriver/testutil/mocks/httpmocks"
"git.grassecon.net/grassrootseconomics/visedriver/request"
"git.grassecon.net/grassrootseconomics/visedriver/testutil/mocks/httpmocks"
)
// invalidRequestType is a custom type to test invalid request scenarios

View File

@ -4,10 +4,10 @@ import (
"context"
"io"
"git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/visedriver/storage"
)

View File

@ -35,7 +35,7 @@ func (c Conns) Set(conn ConnData, typ int8) {
}
func (c Conns) Have(conn *ConnData) int8 {
for i := range(_STORETYPE_MAX) {
for i := range _STORETYPE_MAX {
ii := int8(i)
v, ok := c[ii]
if !ok {

View File

@ -7,7 +7,6 @@ import (
"os"
"path"
"github.com/jackc/pgx/v5/pgxpool"
"git.defalsify.org/vise.git/db"
fsdb "git.defalsify.org/vise.git/db/fs"
memdb "git.defalsify.org/vise.git/db/mem"
@ -17,6 +16,7 @@ import (
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
gdbmstorage "git.grassecon.net/grassrootseconomics/visedriver/storage/db/gdbm"
"github.com/jackc/pgx/v5/pgxpool"
)
var (
@ -70,7 +70,7 @@ func (ms *MenuStorageService) checkDb(ctx context.Context,typ int8) db.Db {
return nil
}
ms.store[typ] = ms.store[v]
logg.DebugCtxf(ctx, "found existing db", "typ", typ, "srctyp", v, "store", ms.store[typ], "srcstore", ms.store[v])
logg.DebugCtxf(ctx, "found existing db", "typ", typ, "srctyp", v, "store", ms.store[typ], "srcstore", ms.store[v], "conn", connData)
return ms.store[typ]
}
@ -135,7 +135,7 @@ func (ms *MenuStorageService) WithGettext(path string, lns []lang.Language) *Men
}
rs := resource.NewPoResource(lns[0], path)
for _, ln := range(lns) {
for _, ln := range lns {
rs = rs.WithLanguage(ln)
}
@ -228,7 +228,7 @@ func (ms *MenuStorageService) ensureDbDir(path string) error {
func (ms *MenuStorageService) Close(ctx context.Context) error {
var errs []error
var haveErr bool
for i := range(_STORETYPE_MAX) {
for i := range _STORETYPE_MAX {
err := ms.store[int8(i)].Close(ctx)
if err != nil {
haveErr = true
@ -237,7 +237,7 @@ func (ms *MenuStorageService) Close(ctx context.Context) error {
}
if haveErr {
errStr := ""
for i, err := range(errs) {
for i, err := range errs {
errStr += fmt.Sprintf("(%d: %v)", i, err)
}
return errors.New(errStr)

View File

@ -5,8 +5,8 @@ import (
"git.defalsify.org/vise.git/db"
memdb "git.defalsify.org/vise.git/db/mem"
"git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
)
type MemStorageService struct {
@ -39,4 +39,3 @@ func (mss *MemStorageService) GetUserdataDb(ctx context.Context) (db.Db, error)
func (mss *MemStorageService) GetResource(ctx context.Context) (resource.Resource, error) {
return mss.rs, nil
}