From 75278be9b54e96d69668214de968a4517f4ab6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 21 Feb 2021 14:18:14 +0100 Subject: Slight restructuring --- pkg/config/config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/config/config.go b/pkg/config/config.go index 31012a1..bfaefdf 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -104,7 +104,7 @@ func (opt GlobalOptions) WithPartHtml() bool { return util.StrContains(opt.Parts, "html") } -// Load configuration from file +// Load configuration from file and validate it func Load(path string) (*Config, error) { log.Printf("Reading configuration file '%s'", path) @@ -118,6 +118,10 @@ func Load(path string) (*Config, error) { return nil, fmt.Errorf("while parsing: %w", err) } + if err = cfg.Validate(); err != nil { + return nil, fmt.Errorf("Configuration invalid: %w", err) + } + return cfg, nil } -- cgit v1.2.3