diff --git a/main.go b/main.go index b8ba736..15a3fe7 100644 --- a/main.go +++ b/main.go @@ -58,6 +58,14 @@ func main() { log.Fatalf("⚠ Failed to load config %q: %v.", configFile, err) } + // validate config unless in export mode, where an incomplete + // configuration is allowed and even expected + if !exportMode { + if err := cfg.Validate(); err != nil { + log.Fatalf("Configuration is invalid: %v", err) + } + } + if validate { log.Println("✓ Configuration is valid.") return diff --git a/pkg/config/config.go b/pkg/config/config.go index da2fca5..32e593d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -61,10 +61,6 @@ func LoadFromFile(filename string) (*Config, error) { return nil, err } - if err := config.Validate(); err != nil { - return nil, err - } - return config, nil }