diff --git a/beehive.go b/beehive.go index 42d0a004..aeedaf84 100644 --- a/beehive.go +++ b/beehive.go @@ -110,7 +110,7 @@ func main() { if err != nil { log.Fatalf("Error loading configuration file from %s. err: %v", config.URL(), err) } - log.Infof("Loading configuration from %s", config.URL()) + log.Infof("Loading configuration from %s", config.URL().Raw) } else { // try to load default config from user paths path := cfg.Lookup() if path == "" { diff --git a/cfg/config.go b/cfg/config.go index ccf9b33b..e99c6bc7 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -6,6 +6,7 @@ import ( "path/filepath" "regexp" "runtime" + "strings" "github.com/muesli/beehive/bees" gap "github.com/muesli/go-app-paths" @@ -157,7 +158,7 @@ func DefaultPath() string { return cfgFileName } - return path + return fixWindowsPath(path) } // Lookup tries to find the config file. @@ -201,3 +202,13 @@ func exist(file string) bool { _, err := os.Stat(file) return err == nil } + +// Replace backward slashes in Windows paths with /, to make them suitable +// for Go URL parsing. +func fixWindowsPath(path string) string { + if runtime.GOOS == "windows" { + return strings.Replace(path, `\`, "/", -1) + } + + return path +} diff --git a/cfg/helpers_test.go b/cfg/helpers_test.go index 0e8c7f09..0fb870db 100644 --- a/cfg/helpers_test.go +++ b/cfg/helpers_test.go @@ -4,20 +4,8 @@ import ( "io/ioutil" "os" "path/filepath" - "runtime" - "strings" ) -// Replace backward slashes in Windows paths with /, to make them suitable -// for Go URL parsing. -func fixWindowsPath(path string) string { - if runtime.GOOS == "windows" { - return strings.Replace(path, `\`, "/", -1) - } - - return path -} - func encryptedConfPath() string { cwd, _ := os.Getwd() return fixWindowsPath(filepath.Join(cwd, "testdata", "beehive-crypto.conf"))