diff --git a/cmd/gophermart/env.go b/cmd/gophermart/env.go index f539d7b..6b4f3b9 100644 --- a/cmd/gophermart/env.go +++ b/cmd/gophermart/env.go @@ -1,17 +1,20 @@ package main import ( + "os" + "github.com/Chystik/gophermart/config" "github.com/caarlos0/env" + "github.com/joho/godotenv" ) func parseEnv(cfg *config.App) error { - /* if osEnv := os.Getenv("ENVIRONMENT"); osEnv == "dev" { + if osEnv := os.Getenv("ENVIRONMENT"); osEnv == "dev" { err := godotenv.Load(".env.dev") if err != nil { return err } - } */ + } return env.Parse(cfg) } diff --git a/cmd/gophermart/flags.go b/cmd/gophermart/flags.go index 3058eca..8665800 100644 --- a/cmd/gophermart/flags.go +++ b/cmd/gophermart/flags.go @@ -1,6 +1,6 @@ package main -import ( +/* import ( "flag" "strings" @@ -17,4 +17,4 @@ func parseFlags(cfg *config.App) { cfg.Address = strings.TrimPrefix(addr, "http://") cfg.AccrualAddress = strings.TrimPrefix(accr, "http://") -} +} */ diff --git a/cmd/gophermart/main.go b/cmd/gophermart/main.go index c7e897c..119fc5c 100644 --- a/cmd/gophermart/main.go +++ b/cmd/gophermart/main.go @@ -1,7 +1,6 @@ package main import ( - "log" "os" "os/signal" "syscall" @@ -13,11 +12,11 @@ import ( func main() { cfg := config.NewAppConfig() - parseFlags(cfg) err := parseEnv(cfg) if err != nil { - log.Fatalln(err) + panic(err) } + //parseFlags(cfg) // Graceful shutdown setup quit := make(chan os.Signal, 1)