Browse Source

support gcfg tags

master
forestjohnson 5 years ago
parent
commit
dad3f15fa3
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      override.go

+ 5
- 2
override.go View File

@ -49,8 +49,11 @@ func applyEnvOverrides(kv keyValueRetriever, prefix string, spec reflect.Value,
typeOfSpec := s.Type()
for i := 0; i < s.NumField(); i++ {
f := s.Field(i)
// Get the toml tag to determine what env var name to use
configName := typeOfSpec.Field(i).Tag.Get("toml")
// Get the tag to determine what env var name to use
configName := typeOfSpec.Field(i).Tag.Get("gcfg")
if configName == "" {
configName = typeOfSpec.Field(i).Tag.Get("toml")
}
if configName == "" {
configName = typeOfSpec.Field(i).Tag.Get("json")
}


Loading…
Cancel
Save