Merge pull request #178 from kerberos-io/fix/secondary-vault-initialization

Fix/Add kstorage_secondary configuration field and initialize in environment vars
This commit is contained in:
Cédric Verstraeten
2025-04-24 11:59:39 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -98,6 +98,7 @@
"region": "eu-west-1"
},
"kstorage": {},
"kstorage_secondary": {},
"dropbox": {},
"mqtturi": "tcp://mqtt.kerberos.io:1883",
"mqtt_username": "",

View File

@@ -183,15 +183,19 @@ func OpenConfig(configDirectory string, configuration *models.Configuration) {
}
jsonFile.Close()
}
}
return
}
// This function will override the configuration with environment variables.
func OverrideWithEnvironmentVariables(configuration *models.Configuration) {
environmentVariables := os.Environ()
// Initialize the configuration for some new fields.
if configuration.Config.KStorageSecondary == nil {
configuration.Config.KStorageSecondary = &models.KStorage{}
}
for _, env := range environmentVariables {
if strings.Contains(env, "AGENT_") {
key := strings.Split(env, "=")[0]