From 2992f7ae8e9983c51aeb1328197270db395b5b1a Mon Sep 17 00:00:00 2001 From: lash Date: Sat, 4 Jan 2025 13:19:30 +0000 Subject: [PATCH] Update executables with new conn str --- cmd/africastalking/main.go | 7 ++++--- cmd/async/main.go | 6 +++--- cmd/http/main.go | 6 +++--- cmd/main.go | 6 +++--- internal/storage/parse.go | 3 --- internal/storage/storageservice.go | 1 - 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/cmd/africastalking/main.go b/cmd/africastalking/main.go index e1035e9..8820215 100644 --- a/cmd/africastalking/main.go +++ b/cmd/africastalking/main.go @@ -34,6 +34,7 @@ var ( func init() { initializers.LoadEnvVariables() } + func main() { config.LoadConfig() @@ -47,15 +48,15 @@ func main() { var err error flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir") - flag.StringVar(&connStr, "c", ".", "connection string") + flag.StringVar(&connStr, "c", ".state", "connection string") flag.BoolVar(&engineDebug, "d", false, "use engine debug output") flag.UintVar(&size, "s", 160, "max size of output") flag.StringVar(&host, "h", initializers.GetEnv("HOST", "127.0.0.1"), "http host") flag.UintVar(&port, "p", initializers.GetEnvUint("PORT", 7123), "http port") flag.Parse() - if connStr == "." { - connStr, err = filepath.Abs(".state/state.gdbm") + if connStr == ".state" { + connStr, err = filepath.Abs(connStr) if err != nil { fmt.Fprintf(os.Stderr, "auto connstr generate error: %v", err) os.Exit(1) diff --git a/cmd/async/main.go b/cmd/async/main.go index a9a0b1e..8b15031 100644 --- a/cmd/async/main.go +++ b/cmd/async/main.go @@ -59,15 +59,15 @@ func main() { flag.StringVar(&sessionId, "session-id", "075xx2123", "session id") flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir") - flag.StringVar(&connStr, "c", ".", "connection string") + flag.StringVar(&connStr, "c", ".state", "connection string") flag.BoolVar(&engineDebug, "d", false, "use engine debug output") flag.UintVar(&size, "s", 160, "max size of output") flag.StringVar(&host, "h", initializers.GetEnv("HOST", "127.0.0.1"), "http host") flag.UintVar(&port, "p", initializers.GetEnvUint("PORT", 7123), "http port") flag.Parse() - if connStr == "." { - connStr, err = filepath.Abs(".state/state.gdbm") + if connStr == ".state" { + connStr, err = filepath.Abs(connStr) if err != nil { fmt.Fprintf(os.Stderr, "auto connstr generate error: %v", err) os.Exit(1) diff --git a/cmd/http/main.go b/cmd/http/main.go index 070cf79..f42d4d9 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -47,15 +47,15 @@ func main() { var err error flag.StringVar(&resourceDir, "resourcedir", path.Join("services", "registration"), "resource dir") - flag.StringVar(&connStr, "c", ".", "connection string") + flag.StringVar(&connStr, "c", ".state", "connection string") flag.BoolVar(&engineDebug, "d", false, "use engine debug output") flag.UintVar(&size, "s", 160, "max size of output") flag.StringVar(&host, "h", initializers.GetEnv("HOST", "127.0.0.1"), "http host") flag.UintVar(&port, "p", initializers.GetEnvUint("PORT", 7123), "http port") flag.Parse() - if connStr == "." { - connStr, err = filepath.Abs(".state/state.gdbm") + if connStr == ".state" { + connStr, err = filepath.Abs(connStr) if err != nil { fmt.Fprintf(os.Stderr, "auto connstr generate error: %v", err) os.Exit(1) diff --git a/cmd/main.go b/cmd/main.go index c45615b..2506012 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -39,13 +39,13 @@ func main() { var err error flag.StringVar(&sessionId, "session-id", "075xx2123", "session id") - flag.StringVar(&connStr, "c", ".", "connection string") + flag.StringVar(&connStr, "c", ".state", "connection string") flag.BoolVar(&engineDebug, "d", false, "use engine debug output") flag.UintVar(&size, "s", 160, "max size of output") flag.Parse() - if connStr == "." { - connStr, err = filepath.Abs(".state/state.gdbm") + if connStr == ".state" { + connStr, err = filepath.Abs(connStr) if err != nil { fmt.Fprintf(os.Stderr, "auto connstr generate error: %v", err) os.Exit(1) diff --git a/internal/storage/parse.go b/internal/storage/parse.go index d4bc564..a97b938 100644 --- a/internal/storage/parse.go +++ b/internal/storage/parse.go @@ -40,9 +40,6 @@ func probeGdbm(s string) (string, bool) { if !path.IsAbs(s) { return "", false } - if path.Ext(s) != ".gdbm" { - return "", false - } s = path.Clean(s) return s, true } diff --git a/internal/storage/storageservice.go b/internal/storage/storageservice.go index e14b7a4..68e6916 100644 --- a/internal/storage/storageservice.go +++ b/internal/storage/storageservice.go @@ -28,7 +28,6 @@ type StorageService interface { } type MenuStorageService struct { - //dbDir string conn connData resourceDir string resourceStore db.Db