Skip to content

Commit

Permalink
BUG/MEDIUM: config: validate configuration file before starting
Browse files Browse the repository at this point in the history
  • Loading branch information
mjuraga committed May 31, 2021
1 parent 05277cc commit 5344362
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5344362

Please sign in to comment.