Correct config override handling
Some checks are pending
release / docker (push) Waiting to run

This commit is contained in:
lash 2025-01-24 09:03:13 +00:00
parent a66a11abe6
commit d1acde4e01
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 12 additions and 20 deletions

View File

@ -9,6 +9,7 @@ import (
"syscall"
"git.defalsify.org/vise.git/logging"
sarafuconfig "git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise-events/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise-events/event/nats"
"git.grassecon.net/grassrootseconomics/sarafu-vise-events/lookup"
@ -23,7 +24,7 @@ var (
func main() {
config.LoadConfig()
override := config.NewOverride()
override := sarafuconfig.NewOverride()
flag.StringVar(override.DbConn, "c", "?", "default connection string (replaces all unspecified strings)")
flag.StringVar(override.ResourceConn, "resource", "?", "resource connection string")
@ -31,8 +32,8 @@ func main() {
flag.StringVar(override.StateConn, "state", "?", "state store connection string")
flag.Parse()
config.Apply(&override)
conns, err := config.GetConns()
sarafuconfig.Apply(override)
conns, err := sarafuconfig.GetConns()
if err != nil {
fmt.Fprintf(os.Stderr, "conn specification error: %v\n", err)
os.Exit(1)

View File

@ -1,9 +1,8 @@
package config
import (
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
"git.grassecon.net/grassrootseconomics/visedriver/env"
)
@ -20,11 +19,7 @@ const (
)
func LoadConfig() error {
err := viseconfig.LoadConfig()
if err != nil {
return err
}
err = apiconfig.LoadConfig()
err := config.LoadConfig()
if err != nil {
return err
}
@ -36,7 +31,3 @@ func LoadConfig() error {
func Language() string {
return viseconfig.DefaultLanguage
}
func NewOverride() config.Override {
return config.Override{}
}

4
go.mod
View File

@ -6,8 +6,8 @@ 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/sarafu-vise v0.0.0-20250121142648-4baacb325d2b
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250121134912-f7d31e4e8162
git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250124084723-9a094f440f86
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250122123424-6749c632b0a2
github.com/grassrootseconomics/eth-tracker v1.3.0-rc
github.com/grassrootseconomics/ussd-data-service v1.2.0-beta
github.com/nats-io/nats.go v1.37.0

8
go.sum
View File

@ -4,10 +4,10 @@ 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/sarafu-vise v0.0.0-20250121142648-4baacb325d2b h1:kUQW5cM4Q7TogrUfrxFjdvA/BYCescsAZBtf5teLYrY=
git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250121142648-4baacb325d2b/go.mod h1:AF6qgkV+OmxamrPcrzZfsRUYTaQMZXBRejRg7dIKej4=
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250121134912-f7d31e4e8162 h1:NaPbgGQ1Nb+yYF+Qj1LSagpjYeDcSXST8iZwONg4afY=
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250121134912-f7d31e4e8162/go.mod h1:pjKp9L/ZsWW3kMB0UoIl1yv9TBIuU33mn9Aghxp7vGk=
git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250124084723-9a094f440f86 h1:wqISfQKU7nJgKVGGMm/b0M46tMRmvkBc+riLOWzd7ss=
git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250124084723-9a094f440f86/go.mod h1:kt/HZVYJZoQLzJtHKSfltZu7+khRUUq5P98PtPpKbUc=
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=
github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk=
github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ=
github.com/alecthomas/participle/v2 v2.0.0 h1:Fgrq+MbuSsJwIkw3fEj9h75vDP0Er5JzepJ0/HNHv0g=