Merge pull request #262 from prymitive/fix-config-fallback

fix(config): default to 'karma.yaml' config file
This commit is contained in:
Łukasz Mierzwa
2018-11-22 23:43:29 +00:00
committed by GitHub
+7
View File
@@ -3,6 +3,7 @@ package config
import (
"bufio"
"bytes"
"os"
"strings"
"time"
@@ -106,6 +107,12 @@ func (config *configSchema) Read() {
v.SetConfigType("yaml")
configFile := v.GetString("config.file")
// if config file is not set then try loading karma.yaml from current directory
if configFile == "" {
if _, err = os.Stat("karma.yaml"); !os.IsNotExist(err) {
configFile = "karma.yaml"
}
}
if configFile != "" {
log.Infof("Reading configuration file %s", configFile)
v.SetConfigFile(configFile)