Skip to content

Commit 5344362

Browse files
committed
BUG/MEDIUM: config: validate configuration file before starting
1 parent 05277cc commit 5344362

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

configuration/configuration.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ func (c *Configuration) Load() error {
231231
c.storage = &StorageHCL{}
232232
}
233233
if err = c.storage.Load(c.HAProxy.DataplaneConfig); err != nil {
234-
log.Warnf("configuration file %s does not exists, creating one", c.HAProxy.DataplaneConfig)
234+
if os.IsNotExist(err) {
235+
log.Warnf("configuration file %s does not exists, creating one", c.HAProxy.DataplaneConfig)
236+
} else {
237+
return fmt.Errorf("configuration file %s not valid: %w", c.HAProxy.DataplaneConfig, err)
238+
}
235239
}
236240
}
237241
copyToConfiguration(c)

0 commit comments

Comments
 (0)