diff --git a/cmd/africastalking/main.go b/cmd/africastalking/main.go index 72d3944..fd82a79 100644 --- a/cmd/africastalking/main.go +++ b/cmd/africastalking/main.go @@ -14,26 +14,27 @@ import ( "git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/resource" - "git.defalsify.org/vise.git/lang" + testdataloader "github.com/peteole/testdata-loader" "git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/initializers" + "git.grassecon.net/urdt/ussd/internal/args" "git.grassecon.net/urdt/ussd/internal/handlers" "git.grassecon.net/urdt/ussd/internal/http/at" "git.grassecon.net/urdt/ussd/internal/storage" "git.grassecon.net/urdt/ussd/remote" - "git.grassecon.net/urdt/ussd/internal/args" ) var ( logg = logging.NewVanilla().WithDomain("AfricasTalking").WithContextKey("at-session-id") + baseDir = testdataloader.GetBasePath() scriptDir = path.Join("services", "registration") build = "dev" menuSeparator = ": " ) func init() { - initializers.LoadEnvVariables() + initializers.LoadEnvVariables(baseDir) } func main() { diff --git a/cmd/async/main.go b/cmd/async/main.go index dc293e6..3ba8d3a 100644 --- a/cmd/async/main.go +++ b/cmd/async/main.go @@ -12,24 +12,25 @@ import ( "git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/resource" - "git.defalsify.org/vise.git/lang" + testdataloader "github.com/peteole/testdata-loader" "git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/initializers" + "git.grassecon.net/urdt/ussd/internal/args" "git.grassecon.net/urdt/ussd/internal/handlers" "git.grassecon.net/urdt/ussd/internal/storage" "git.grassecon.net/urdt/ussd/remote" - "git.grassecon.net/urdt/ussd/internal/args" ) var ( logg = logging.NewVanilla() + baseDir = testdataloader.GetBasePath() scriptDir = path.Join("services", "registration") menuSeparator = ": " ) func init() { - initializers.LoadEnvVariables() + initializers.LoadEnvVariables(baseDir) } type asyncRequestParser struct { @@ -117,7 +118,6 @@ func main() { os.Exit(1) } - userdataStore, err := menuStorageService.GetUserdataDb(ctx) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) diff --git a/cmd/http/main.go b/cmd/http/main.go index 8e65232..4d161c8 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -14,25 +14,26 @@ import ( "git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/resource" - "git.defalsify.org/vise.git/lang" + testdataloader "github.com/peteole/testdata-loader" "git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/initializers" + "git.grassecon.net/urdt/ussd/internal/args" "git.grassecon.net/urdt/ussd/internal/handlers" httpserver "git.grassecon.net/urdt/ussd/internal/http" "git.grassecon.net/urdt/ussd/internal/storage" "git.grassecon.net/urdt/ussd/remote" - "git.grassecon.net/urdt/ussd/internal/args" ) var ( - logg = logging.NewVanilla() - scriptDir = path.Join("services", "registration") + logg = logging.NewVanilla() + baseDir = testdataloader.GetBasePath() + scriptDir = path.Join("services", "registration") menuSeparator = ": " ) func init() { - initializers.LoadEnvVariables() + initializers.LoadEnvVariables(baseDir) } func main() { @@ -94,7 +95,7 @@ func main() { } menuStorageService := storage.NewMenuStorageService(connData, resourceDir) - + rs, err := menuStorageService.GetResource(ctx) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) diff --git a/cmd/main.go b/cmd/main.go index 3939c9d..f2cf902 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -17,16 +17,18 @@ import ( "git.grassecon.net/urdt/ussd/internal/storage" "git.grassecon.net/urdt/ussd/internal/args" "git.grassecon.net/urdt/ussd/remote" + testdataloader "github.com/peteole/testdata-loader" ) var ( logg = logging.NewVanilla() + baseDir = testdataloader.GetBasePath() scriptDir = path.Join("services", "registration") menuSeparator = ": " ) func init() { - initializers.LoadEnvVariables() + initializers.LoadEnvVariables(baseDir) } // TODO: external script automatically generate language handler list from select language vise code OR consider dynamic menu generation script possibility diff --git a/devtools/store/dump/main.go b/devtools/store/dump/main.go index c84a134..1627a04 100644 --- a/devtools/store/dump/main.go +++ b/devtools/store/dump/main.go @@ -7,31 +7,22 @@ import ( "os" "path" + "git.defalsify.org/vise.git/db" + "git.defalsify.org/vise.git/logging" "git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/initializers" "git.grassecon.net/urdt/ussd/internal/storage" - "git.grassecon.net/urdt/ussd/debug" - "git.defalsify.org/vise.git/db" - "git.defalsify.org/vise.git/logging" + testdataloader "github.com/peteole/testdata-loader" ) var ( logg = logging.NewVanilla() + baseDir = testdataloader.GetBasePath() scriptDir = path.Join("services", "registration") ) func init() { - initializers.LoadEnvVariables() -} - - -func formatItem(k []byte, v []byte) (string, error) { - o, err := debug.FromKey(k) - if err != nil { - return "", err - } - s := fmt.Sprintf("%vValue: %v\n\n", o, string(v)) - return s, nil + initializers.LoadEnvVariables(baseDir) } func main() { diff --git a/devtools/store/generate/main.go b/devtools/store/generate/main.go index 749f340..58a9808 100644 --- a/devtools/store/generate/main.go +++ b/devtools/store/generate/main.go @@ -9,22 +9,23 @@ import ( "path" "git.defalsify.org/vise.git/logging" - "git.grassecon.net/urdt/ussd/config" - "git.grassecon.net/urdt/ussd/internal/storage" - "git.grassecon.net/urdt/ussd/initializers" "git.grassecon.net/urdt/ussd/common" + "git.grassecon.net/urdt/ussd/config" + "git.grassecon.net/urdt/ussd/initializers" + "git.grassecon.net/urdt/ussd/internal/storage" + testdataloader "github.com/peteole/testdata-loader" ) var ( logg = logging.NewVanilla() + baseDir = testdataloader.GetBasePath() scriptDir = path.Join("services", "registration") ) func init() { - initializers.LoadEnvVariables() + initializers.LoadEnvVariables(baseDir) } - func main() { config.LoadConfig() @@ -86,5 +87,4 @@ func main() { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } - }