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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,10 +4,10 @@ import (
"context" "context"
"io" "io"
"git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/logging"
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/visedriver/storage" "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 { func (c Conns) Have(conn *ConnData) int8 {
for i := range(_STORETYPE_MAX) { for i := range _STORETYPE_MAX {
ii := int8(i) ii := int8(i)
v, ok := c[ii] v, ok := c[ii]
if !ok { if !ok {

View File

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

View File

@ -5,8 +5,8 @@ import (
"git.defalsify.org/vise.git/db" "git.defalsify.org/vise.git/db"
memdb "git.defalsify.org/vise.git/db/mem" 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/persist"
"git.defalsify.org/vise.git/resource"
) )
type MemStorageService struct { 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) { func (mss *MemStorageService) GetResource(ctx context.Context) (resource.Resource, error) {
return mss.rs, nil return mss.rs, nil
} }