From 5344362089a0898b87eb9ac46f46d200668cf76a Mon Sep 17 00:00:00 2001 From: Marko Juraga Date: Mon, 31 May 2021 15:04:45 +0200 Subject: [PATCH] BUG/MEDIUM: config: validate configuration file before starting --- configuration/configuration.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configuration/configuration.go b/configuration/configuration.go index 1d5b5d54..529830f4 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -231,7 +231,11 @@ func (c *Configuration) Load() error { c.storage = &StorageHCL{} } if err = c.storage.Load(c.HAProxy.DataplaneConfig); err != nil { - log.Warnf("configuration file %s does not exists, creating one", c.HAProxy.DataplaneConfig) + if os.IsNotExist(err) { + log.Warnf("configuration file %s does not exists, creating one", c.HAProxy.DataplaneConfig) + } else { + return fmt.Errorf("configuration file %s not valid: %w", c.HAProxy.DataplaneConfig, err) + } } } copyToConfiguration(c)