fix: only panic if the error is other than a missing config file
This commit is contained in:
parent
241db4deb6
commit
6e0ec8aaf9
|
@ -34,7 +34,13 @@ func Init() {
|
|||
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
if errors.As(err, &viper.ConfigFileNotFoundError{}) {
|
||||
// Config file not found, this is not an error.
|
||||
fmt.Println("Config file not found, using default settings.")
|
||||
} else {
|
||||
// Other error, panic.
|
||||
panic(fmt.Errorf("Fatal error config file: %s \n", err))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue