mirror of
https://github.com/kerberos-io/agent.git
synced 2025-10-20 23:09:45 +08:00
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:
@@ -98,6 +98,7 @@
|
|||||||
"region": "eu-west-1"
|
"region": "eu-west-1"
|
||||||
},
|
},
|
||||||
"kstorage": {},
|
"kstorage": {},
|
||||||
|
"kstorage_secondary": {},
|
||||||
"dropbox": {},
|
"dropbox": {},
|
||||||
"mqtturi": "tcp://mqtt.kerberos.io:1883",
|
"mqtturi": "tcp://mqtt.kerberos.io:1883",
|
||||||
"mqtt_username": "",
|
"mqtt_username": "",
|
||||||
|
@@ -183,15 +183,19 @@ func OpenConfig(configDirectory string, configuration *models.Configuration) {
|
|||||||
}
|
}
|
||||||
jsonFile.Close()
|
jsonFile.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function will override the configuration with environment variables.
|
// This function will override the configuration with environment variables.
|
||||||
func OverrideWithEnvironmentVariables(configuration *models.Configuration) {
|
func OverrideWithEnvironmentVariables(configuration *models.Configuration) {
|
||||||
environmentVariables := os.Environ()
|
environmentVariables := os.Environ()
|
||||||
|
|
||||||
|
// Initialize the configuration for some new fields.
|
||||||
|
if configuration.Config.KStorageSecondary == nil {
|
||||||
|
configuration.Config.KStorageSecondary = &models.KStorage{}
|
||||||
|
}
|
||||||
|
|
||||||
for _, env := range environmentVariables {
|
for _, env := range environmentVariables {
|
||||||
if strings.Contains(env, "AGENT_") {
|
if strings.Contains(env, "AGENT_") {
|
||||||
key := strings.Split(env, "=")[0]
|
key := strings.Split(env, "=")[0]
|
||||||
|
Reference in New Issue
Block a user