From f56e85cc64caa3232546d8c6e86b0b6093b5be7b Mon Sep 17 00:00:00 2001 From: Urko Date: Fri, 3 Mar 2023 22:46:49 +0100 Subject: [PATCH] feat: use env path as parameter --- cfg/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cfg/config.go b/cfg/config.go index 8c68346..92a910a 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -27,9 +27,9 @@ func RootDir() string { return rootDir } -func NewConfig(isProd bool) *Config { - if !isProd { - err := godotenv.Load(RootDir() + "/.env") +func NewConfig(envFilePath string) *Config { + if envFilePath != "" { + err := godotenv.Load(envFilePath) if err != nil { log.Fatalf("environment variable ENV is empty and an error occurred while loading the .env file\n") }