specify the base directory for loading the .env file
This commit is contained in:
parent
4836162f40
commit
3ee15497a5
@ -3,15 +3,17 @@ package initializers
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
func LoadEnvVariables() {
|
||||
err := godotenv.Load()
|
||||
func LoadEnvVariables(baseDir string) {
|
||||
envDir := path.Join(baseDir, ".env")
|
||||
err := godotenv.Load(envDir)
|
||||
if err != nil {
|
||||
log.Fatal("Error loading .env file")
|
||||
log.Fatal("Error loading .env file", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user