Bug #10282
closed
[Go programs]Warn or error when unrecognized keys appear in config files
Added by Tom Clegg almost 8 years ago.
Updated over 5 years ago.
Description
Currently, if a configuration key is misspelled or misplaced in a configuration file, it is silently ignored.
Programs that read configuration files should print a warning message when this happens, to avoid running services with configuration different than intended. Support an optional flag which converts the warning to an error and causes the program to exit.
There is a Go feature in the works that would be helpful. Even with that, we'd still need our YAML library to expose DisallowUnknownFields() -- either that, or convert YAML → map[string]interface{}
→ JSON and then load the resulting JSON to the real struct using DisallowUnknownFields().
If we don't want to wait, we could detect invalid keys by comparing site config to example config (but do not read the example config from /etc at runtime -- rather, build the example config into the Go binary). Load both configs into a map[string]interface{}
, then do a recursive "A's keys are a subset of B's keys" test.
- Description updated (diff)
- Assigned To set to Tom Morris
- Target version set to Arvados Future Sprints
- Subject changed from Log a warning when unrecognized keys appear in config files to Error out when unrecognized keys appear in config files
- Description updated (diff)
- Description updated (diff)
- Subject changed from Error out when unrecognized keys appear in config files to [Go programs] Error out when unrecognized keys appear in config files
- Assigned To deleted (
Tom Morris)
- Target version changed from Arvados Future Sprints to To Be Groomed
- Subject changed from [Go programs] Error out when unrecognized keys appear in config files to [Go programs]Warn or error when unrecognized keys appear in config files
- Description updated (diff)
- Target version changed from To Be Groomed to Arvados Future Sprints
- Story points set to 1.0
- Related to Idea #15003: [config] Go package & tool for preprocessing cluster config file added
- Status changed from New to Feedback
- Status changed from Feedback to Closed
- Target version deleted (
Arvados Future Sprints)
Also available in: Atom
PDF