feat(config): validation on set, refusal to set incorrect values. warns when manually editing with incorrect values
This commit is contained in:
parent
4bd45e7d3c
commit
32459b420b
3 changed files with 36 additions and 1 deletions
|
|
@ -145,6 +145,11 @@ func loadConfig() (Config, []string, error) {
|
|||
return cfg, undecoded, nil
|
||||
}
|
||||
|
||||
// validateConfig checks invariants on a Config value before it is persisted.
|
||||
func validateConfig(cfg Config) error {
|
||||
return validListFormat(cfg.List.DefaultListFormat)
|
||||
}
|
||||
|
||||
func configPath() (string, error) {
|
||||
if override := os.Getenv("PDA_CONFIG"); override != "" {
|
||||
return filepath.Join(override, "config.toml"), nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue