feat: get envfile from path when is not prod

This commit is contained in:
2023-03-03 22:47:44 +01:00
parent f56e85cc64
commit 1b83793f38
3 changed files with 11 additions and 2 deletions

10
main.go
View File

@@ -1,6 +1,7 @@
package main
import (
"flag"
"log"
"os"
"os/signal"
@@ -17,8 +18,13 @@ var (
)
func main() {
isProd := os.Getenv("ENV") == "prod"
config := cfg.NewConfig(isProd)
envFilePath := ""
if os.Getenv("ENV") != "prod" {
flag.StringVar(&envFilePath, ".env path", "/", "provide .env path file as an absolute path")
flag.Parse()
}
config := cfg.NewConfig(envFilePath)
notifierIface = watcher.NewNotifier()
watcherIface = watcher.NewWatcher(notifierIface, pkgwatcher.Deploy)