From 4f9bcba1c40ea9841b90710cbf32ce18151b9e26 Mon Sep 17 00:00:00 2001 From: Martijn-Faber Date: Sat, 15 Jan 2022 11:01:46 +0100 Subject: [PATCH] fix(config): get path from the working dir --- config/config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 8f029b7..c6092f7 100644 --- a/config/config.go +++ b/config/config.go @@ -1,6 +1,8 @@ package config import ( + "os" + "github.com/spf13/viper" ) @@ -17,7 +19,13 @@ type Config struct { } func Load() (config Config, err error) { - viper.AddConfigPath(".") + wd, err := os.Getwd() + + if err != nil { + return + } + + viper.AddConfigPath(wd) viper.SetConfigName("config") viper.SetConfigType("env") viper.AutomaticEnv()