diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/config/config.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 88bc006..6837ea7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -191,12 +191,17 @@ func GetConfig(filename string) (*Config, error) { defer f.Close() dec := toml.NewDecoder(f) + dec.DisallowUnknownFields() err = dec.Decode(&config) if err != nil { var tomlError *toml.DecodeError if errors.As(err, &tomlError) { return nil, errors.WithMessage(err, tomlError.Error()) } + var missingConfigError *toml.StrictMissingError + if errors.As(err, &missingConfigError) { + return nil, errors.Errorf("unexpected config: %s", missingConfigError.String()) + } return nil, errors.Wrap(err, "config error") } |