diff --git a/cmd/africastalking/main.go b/cmd/africastalking/main.go index 4705b1a..368cb95 100644 --- a/cmd/africastalking/main.go +++ b/cmd/africastalking/main.go @@ -17,7 +17,7 @@ import ( "git.defalsify.org/vise.git/resource" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" "git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/visedriver/session" diff --git a/cmd/async/main.go b/cmd/async/main.go index f024d5d..79a523e 100644 --- a/cmd/async/main.go +++ b/cmd/async/main.go @@ -15,7 +15,7 @@ import ( "git.defalsify.org/vise.git/resource" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" "git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/visedriver/session" "git.grassecon.net/grassrootseconomics/visedriver/request" diff --git a/cmd/http/main.go b/cmd/http/main.go index e2339a6..7d5ed55 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -17,7 +17,7 @@ import ( "git.defalsify.org/vise.git/resource" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" httpsession "git.grassecon.net/grassrootseconomics/visedriver/session/http" "git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/visedriver/session" diff --git a/cmd/main.go b/cmd/main.go index 8963fcb..d6fa3f3 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,7 +12,7 @@ import ( "git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/lang" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" "git.grassecon.net/grassrootseconomics/visedriver/storage" httpremote "git.grassecon.net/grassrootseconomics/sarafu-api/remote/http" "git.grassecon.net/grassrootseconomics/sarafu-vise/args" diff --git a/cmd/ssh/main.go b/cmd/ssh/main.go index 0444ceb..8498fb4 100644 --- a/cmd/ssh/main.go +++ b/cmd/ssh/main.go @@ -15,7 +15,7 @@ import ( "git.defalsify.org/vise.git/logging" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" "git.grassecon.net/grassrootseconomics/sarafu-vise/ssh" "git.grassecon.net/grassrootseconomics/visedriver/storage" ) diff --git a/config/config.go b/config/config.go index 53b44ab..1a2032b 100644 --- a/config/config.go +++ b/config/config.go @@ -1,66 +1,25 @@ package config import ( - "strings" - - "git.grassecon.net/grassrootseconomics/common/env" + viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config" apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config" ) - var ( - defaultLanguage = "eng" - languages []string + DbConn = viseconfig.DbConn + DefaultLanguage = viseconfig.DefaultLanguage ) -var ( - DbConn string - DefaultLanguage string - Languages []string -) - -func setLanguage() error { - defaultLanguage = env.GetEnv("DEFAULT_LANGUAGE", defaultLanguage) - languages = strings.Split(env.GetEnv("LANGUAGES", defaultLanguage), ",") - haveDefaultLanguage := false - for i, v := range(languages) { - languages[i] = strings.ReplaceAll(v, " ", "") - if languages[i] == defaultLanguage { - haveDefaultLanguage = true - } - } - - if !haveDefaultLanguage { - languages = append([]string{defaultLanguage}, languages...) - } - - return nil -} - - - -func setConn() error { - DbConn = env.GetEnv("DB_CONN", "") - return nil -} - -// LoadConfig initializes the configuration values after environment variables are loaded. func LoadConfig() error { - //err := apiconfig.SetBase() - err := apiconfig.LoadConfig() + err := viseconfig.LoadConfig() if err != nil { return err } - err = setConn() + err = apiconfig.LoadConfig() if err != nil { return err } - err = setLanguage() - if err != nil { - return err - } - DefaultLanguage = defaultLanguage - Languages = languages - + DbConn = viseconfig.DbConn + DefaultLanguage = viseconfig.DefaultLanguage return nil } diff --git a/devtools/lang/main.go b/devtools/lang/main.go index 2cbf2a3..a9af774 100644 --- a/devtools/lang/main.go +++ b/devtools/lang/main.go @@ -10,8 +10,8 @@ import ( "git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/lang" - "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/config" + "git.grassecon.net/grassrootseconomics/visedriver/env" ) const ( diff --git a/devtools/store/dump/main.go b/devtools/store/dump/main.go index 826576b..af9891d 100644 --- a/devtools/store/dump/main.go +++ b/devtools/store/dump/main.go @@ -8,7 +8,7 @@ import ( "path" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" "git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/sarafu-vise/debug" "git.defalsify.org/vise.git/db" diff --git a/devtools/store/generate/main.go b/devtools/store/generate/main.go index 3daa435..58881e8 100644 --- a/devtools/store/generate/main.go +++ b/devtools/store/generate/main.go @@ -12,7 +12,7 @@ import ( "git.defalsify.org/vise.git/logging" "git.grassecon.net/grassrootseconomics/sarafu-vise/config" "git.grassecon.net/grassrootseconomics/visedriver/storage" - "git.grassecon.net/grassrootseconomics/common/env" + "git.grassecon.net/grassrootseconomics/visedriver/env" "git.grassecon.net/grassrootseconomics/sarafu-vise/store" storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db" ) diff --git a/go.mod b/go.mod index d23f254..07b5111 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.23.4 require ( git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d - git.grassecon.net/grassrootseconomics/common v0.0.0-20250112094202-96345daf4d75 - git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112095506-c877bccff604 - git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112093740-ec4ad6e44b3f + git.grassecon.net/grassrootseconomics/common v0.0.0-20250112102149-4feac5e490e9 + git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112102608-1152fb71a590 + git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112102450-dcf777bf08d3 git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250112092227-e0892ac0be76 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 3a0bd11..2eb5ced 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,11 @@ git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d h1:bPAOVZOX4frSGhfOdcj7kc555f8dc9DmMd2YAyC2AMw= git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck= -git.grassecon.net/grassrootseconomics/common v0.0.0-20250112094202-96345daf4d75 h1:g/dZdu1teBggAMFCwm7BpV44bz394+nhAduULjX6Kk4= -git.grassecon.net/grassrootseconomics/common v0.0.0-20250112094202-96345daf4d75/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60= -git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112095506-c877bccff604 h1:5s+vedXGY9Glt0uhbWgxH5O2rjOqDqgwvUBdZktu+PA= -git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112095506-c877bccff604/go.mod h1:8qm6dwqOzUdAjxdeB/f0kiBwYvI4Mr1uYVaJpP2w3c4= -git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112093740-ec4ad6e44b3f h1:Ev39tqya9KxU5ABXFOv5TXl5s5rZnuT4B6BYZ1aIzns= -git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112093740-ec4ad6e44b3f/go.mod h1:E6W7ZOa7ZvVr0Bc5ot0LNSwpSPYq4hXlAIvEPy3AJ7U= +git.grassecon.net/grassrootseconomics/common v0.0.0-20250112102149-4feac5e490e9 h1:dQ8DtiOUPzzXYgZw6REnIc1dhb3PzCEfN01Rd7Pbw+o= +git.grassecon.net/grassrootseconomics/common v0.0.0-20250112102149-4feac5e490e9/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60= +git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112102608-1152fb71a590 h1:2twsWy9E3aWgKeY1rNaD/CTq2VtAQfaAhOstTQVQQrc= +git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250112102608-1152fb71a590/go.mod h1:vgPJiqbRBlpsMt1iFd94onNvE7I9s6r78Ph2CpxOUMs= +git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112102450-dcf777bf08d3 h1:aEy3fuBdKrKs3DC4AcDffed2dRl1I6anVI8DpfmItaE= +git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250112102450-dcf777bf08d3/go.mod h1:E6W7ZOa7ZvVr0Bc5ot0LNSwpSPYq4hXlAIvEPy3AJ7U= git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250112092227-e0892ac0be76 h1:3v0Q/baP/8FEe4kl2DC6pirMgFOAbn69O2f5ddOjcoI= git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250112092227-e0892ac0be76/go.mod h1:JEfOHnOCCwH8s7eevu4ImTdO8oQwRD/bqYtmfT/pwzQ= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= diff --git a/testutil/engine.go b/testutil/engine.go index 4331476..6c37c87 100644 --- a/testutil/engine.go +++ b/testutil/engine.go @@ -15,8 +15,8 @@ import ( "git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/logging" "git.defalsify.org/vise.git/resource" - "git.grassecon.net/grassrootseconomics/common/env" - "git.grassecon.net/grassrootseconomics/sarafu-vise/config" + "git.grassecon.net/grassrootseconomics/visedriver/env" + "git.grassecon.net/grassrootseconomics/visedriver/config" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers" "git.grassecon.net/grassrootseconomics/visedriver/storage" "git.grassecon.net/grassrootseconomics/sarafu-api/testutil/testservice"