Fix warnings about configuration values; should always use the snake case since we're using a marshaled value

This commit is contained in:
Dane Everitt
2020-05-17 17:25:53 -07:00
parent 276bd2be33
commit c802a3397e
4 changed files with 12 additions and 11 deletions

View File

@@ -165,11 +165,8 @@ func (f *ConfigurationFile) LookupConfigurationValue(cfr ConfigurationFileReplac
)
var path []string
// The camel casing is important here, the configuration for the Daemon does not use
// JSON, and as such all of the keys will be generated in CamelCase format, rather than
// the expected snake_case from the old Daemon.
for _, value := range strings.Split(huntPath, ".") {
path = append(path, strcase.ToCamel(value))
path = append(path, strcase.ToSnake(value))
}
// Look for the key in the configuration file, and if found return that value to the

View File

@@ -124,8 +124,12 @@ func (cfr *ConfigurationFileReplacement) UnmarshalJSON(data []byte) error {
func (f *ConfigurationFile) Parse(path string, internal bool) error {
zap.S().Debugw("parsing configuration file", zap.String("path", path), zap.String("parser", string(f.Parser)))
mb, _ := json.Marshal(config.Get())
f.configuration = mb
if mb, err := json.Marshal(config.Get()); err != nil {
return err
} else {
f.configuration = mb
}
var err error