TUN-6994: Improve logging config file not found

This commit is contained in:
João Oliveirinha 2022-12-07 13:13:44 +00:00
parent 7ef9bb89d3
commit 61ccc0b303
1 changed files with 2 additions and 1 deletions

View File

@ -391,7 +391,8 @@ func ReadConfigFile(c *cli.Context, log *zerolog.Logger) (settings *configFileSe
log.Debug().Msgf("Loading configuration from %s", configFile)
file, err := os.Open(configFile)
if err != nil {
if os.IsNotExist(err) {
// If does not exist and config file was not specificly specified then return ErrNoConfigFile found.
if os.IsNotExist(err) && !c.IsSet("config") {
err = ErrNoConfigFile
}
return nil, "", err