diff --git a/cmd/main.go b/cmd/main.go index c0354a7..6dd7e71 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -36,12 +36,10 @@ func main() { var err error var gettextDir string var langs args.LangVar - var resourceDir string flag.StringVar(&sessionId, "session-id", "075xx2123", "session id") flag.StringVar(override.DbConn, "c", "?", "default connection string (replaces all unspecified strings)") flag.StringVar(override.ResourceConn, "resource", "?", "resource data directory") - flag.StringVar(&resourceDir, "resource-dir", "", "resource data directory. If set, overrides --resource to create a non-binary fsdb for the given path.") flag.StringVar(override.UserConn, "userdata", "?", "userdata store connection string") flag.StringVar(override.StateConn, "state", "?", "state store connection string") flag.BoolVar(&engineDebug, "d", false, "use engine debug output") @@ -50,10 +48,6 @@ func main() { flag.Var(&langs, "language", "add symbol resolution for language") flag.Parse() - if resourceDir != "" { - *override.ResourceConn = resourceDir - override.ResourceConnMode = storage.DBMODE_TEXT - } config.Apply(override) conns, err := config.GetConns() if err != nil { diff --git a/cmd/ssh/main.go b/cmd/ssh/main.go index abc4ce5..86bcf4b 100644 --- a/cmd/ssh/main.go +++ b/cmd/ssh/main.go @@ -31,14 +31,13 @@ var ( func main() { config.LoadConfig() - var override config.Override + override := config.NewOverride() var authConnStr string var size uint var engineDebug bool var stateDebug bool var host string var port uint - //flag.StringVar(&authConnStr, "authdb", "", "auth connection string") flag.StringVar(override.DbConn, "c", "?", "default connection string (replaces all unspecified strings)") flag.StringVar(override.ResourceConn, "resource", "?", "resource connection string") flag.StringVar(override.UserConn, "userdata", "?", "userdata store connection string") @@ -49,7 +48,7 @@ func main() { flag.UintVar(&port, "p", config.PortSSH(), "socket port") flag.Parse() - config.Apply(&override) + config.Apply(override) conns, err := config.GetConns() if err != nil { fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err) diff --git a/config/args.go b/config/args.go index a9f69e5..1276619 100644 --- a/config/args.go +++ b/config/args.go @@ -2,6 +2,7 @@ package config import ( viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config" + "git.grassecon.net/grassrootseconomics/visedriver/storage" ) func NewOverride() *viseconfig.Override { @@ -12,8 +13,11 @@ func NewOverride() *viseconfig.Override { o := &viseconfig.Override{ DbConn: &a, StateConn: &b, + StateConnMode: storage.DBMODE_TEXT, ResourceConn: &c, + ResourceConnMode: storage.DBMODE_TEXT, UserConn: &d, + UserConnMode: storage.DBMODE_BINARY, } return o } diff --git a/go.mod b/go.mod index 810b3ab..4fb3c50 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( git.defalsify.org/vise.git v0.2.3-0.20250120121301-10739fb4a8c9 git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250121135150-e0b539809805 - git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122093711-8530c450741a + git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122123424-6749c632b0a2 git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250121135340-ca97e23e8c84 github.com/alecthomas/assert/v2 v2.2.2 github.com/gofrs/uuid v4.4.0+incompatible diff --git a/go.sum b/go.sum index f690755..f3aa2bb 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60= git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250121135150-e0b539809805 h1:deGnqf4YCsbxhXgjFEjYjTUCvciLEmI26T9IysRsQXY= git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250121135150-e0b539809805/go.mod h1:9bc3d//Qqm11hz7GYRdQc1Uan+0GJIOpvRBbv8cHMu8= -git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122093711-8530c450741a h1:g0epqAJvHdOvzdGNfH0ZmZ6QKsbcybOroLnYi78ZnDo= -git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122093711-8530c450741a/go.mod h1:pjKp9L/ZsWW3kMB0UoIl1yv9TBIuU33mn9Aghxp7vGk= +git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122123424-6749c632b0a2 h1:ON77G5K0JNuwPb5JT/hRfF6G6+xstlBQgEIEzWydnhg= +git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122123424-6749c632b0a2/go.mod h1:pjKp9L/ZsWW3kMB0UoIl1yv9TBIuU33mn9Aghxp7vGk= git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250121135340-ca97e23e8c84 h1:VoBmqsjlRdz+IPbtKsAkc1IrMepjR+QlesZT31Jokrk= git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250121135340-ca97e23e8c84/go.mod h1:DpibtYpnT3nG4Kn556hRAkdu4+CtiI/6MbnQHal51mQ= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= diff --git a/testutil/engine.go b/testutil/engine.go index 97c38a3..a179b5d 100644 --- a/testutil/engine.go +++ b/testutil/engine.go @@ -32,7 +32,7 @@ func CleanDatabase() { if conn.DbType() == storage.DBTYPE_POSTGRES { ctx := context.Background() // Update the connection string with the new search path - updatedConnStr := conn.String() + updatedConnStr := conn.Raw() dbConn, err := pgxpool.New(ctx, updatedConnStr) if err != nil { @@ -62,7 +62,7 @@ func CleanDatabase() { func TestEngine(sessionId string) (engine.Engine, func(), chan bool) { config.LoadConfig() - err := config.Apply(&override) + err := config.Apply(override) if err != nil { panic(fmt.Errorf("args override fail: %v\n", err)) } diff --git a/testutil/setup.go b/testutil/setup.go index f57cc2b..58273b7 100644 --- a/testutil/setup.go +++ b/testutil/setup.go @@ -18,7 +18,7 @@ var ( resourceDb db.Db baseDir = testdataloader.GetBasePath() scriptDir = path.Join(baseDir, "services", "registration") - override config.Override + override = config.NewOverride() ) func init() {