Browse Source

Rebuild app

Dima 2 years ago
parent
commit
33382cb92d
2 changed files with 5 additions and 7 deletions
  1. BIN
      build/app/app
  2. 5 7
      internal/services/env/env.go

BIN
build/app/app


+ 5 - 7
internal/services/env/env.go

@@ -2,6 +2,7 @@ package env
 
 
 import (
 import (
 	"bufio"
 	"bufio"
+	"flag"
 	"os"
 	"os"
 	"strings"
 	"strings"
 
 
@@ -10,8 +11,7 @@ import (
 
 
 // nolint:gosec
 // nolint:gosec
 const (
 const (
-	envPathVar = "ENV_PATH"
-	envPath    = "../../config/.env"
+	envPath = "../../config/.env"
 
 
 	appPortEnv = "APP_PORT"
 	appPortEnv = "APP_PORT"
 
 
@@ -59,12 +59,10 @@ type env struct {
 func Init() (interfaces.IEnv, error) {
 func Init() (interfaces.IEnv, error) {
 	res := &env{}
 	res := &env{}
 
 
-	path := os.Getenv(envPathVar)
-	if path == "" {
-		path = envPath
-	}
+	path := flag.String("config", envPath, "path to .env config")
+	flag.Parse()
 
 
-	file, err := os.Open(path)
+	file, err := os.Open(*path)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}