From d1acde4e011fc2ac7169e176f1be529f350b96b0 Mon Sep 17 00:00:00 2001 From: lash Date: Fri, 24 Jan 2025 09:03:13 +0000 Subject: [PATCH] Correct config override handling --- cmd/main.go | 7 ++++--- config/config.go | 13 ++----------- go.mod | 4 ++-- go.sum | 8 ++++---- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index bae2dd2..f97b0ce 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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) diff --git a/config/config.go b/config/config.go index fc6c3d1..a0c94b6 100644 --- a/config/config.go +++ b/config/config.go @@ -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{} -} diff --git a/go.mod b/go.mod index 690ce62..4feeeba 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 9b57610..9b32094 100644 --- a/go.sum +++ b/go.sum @@ -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=