From 13dfae617c8f9e5f67f60ab8b5dc1d6b43f759eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 22 Nov 2018 22:45:43 +0000 Subject: [PATCH] fix(config): default to 'karma.yaml' config file If config.file is not set try loading 'karma.yaml' from current directory. This is the documented behaviour and it used to work before, got broken when config.file was modified to accept a full path instead of just the file name Fixes #261 --- internal/config/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 4e0f9923a..6f0a60d70 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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)