feat: use env path as parameter
This commit is contained in:
parent
4877f72f04
commit
f56e85cc64
|
@ -27,9 +27,9 @@ func RootDir() string {
|
||||||
return rootDir
|
return rootDir
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfig(isProd bool) *Config {
|
func NewConfig(envFilePath string) *Config {
|
||||||
if !isProd {
|
if envFilePath != "" {
|
||||||
err := godotenv.Load(RootDir() + "/.env")
|
err := godotenv.Load(envFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("environment variable ENV is empty and an error occurred while loading the .env file\n")
|
log.Fatalf("environment variable ENV is empty and an error occurred while loading the .env file\n")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue