Do not panic after error reading config file (#2033)

Fixes #1445
This commit is contained in:
Zachary Wasserman 2019-04-23 15:59:02 -07:00 committed by GitHub
parent 5b486a1849
commit 75868a7005
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package config
import (
"fmt"
"os"
"strings"
"time"
@ -486,11 +487,12 @@ func (man Manager) loadConfigFile() {
man.viper.SetConfigFile(configFile)
err := man.viper.ReadInConfig()
fmt.Println("Using config file: ", man.viper.ConfigFileUsed())
if err != nil {
panic("Error reading config: " + err.Error())
fmt.Println("Error loading config file:", err)
os.Exit(1)
}
fmt.Println("Using config file: ", man.viper.ConfigFileUsed())
}
// TestConfig returns a barebones configuration suitable for use in tests.