diff --git a/cmd/app/config.go b/cmd/app/config.go deleted file mode 100644 index 42f8ed3..0000000 --- a/cmd/app/config.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import ( - "os" - - "github.com/go-park-mail-ru/2023_2_OND_team/internal/app" -) - -var configFiles = app.ConfigFiles{ - ServerConfigFile: "configs/config.yml", - AddrAuthServer: os.Getenv("AUTH_SERVICE_HOST") + ":" + os.Getenv("AUTH_SERVICE_PORT"), // "localhost:8085", -} diff --git a/cmd/app/main.go b/cmd/app/main.go index 65db49a..c571572 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -4,9 +4,11 @@ import ( "context" "flag" "fmt" + "os" "github.com/go-park-mail-ru/2023_2_OND_team/internal/app" "github.com/go-park-mail-ru/2023_2_OND_team/pkg/logger" + "github.com/joho/godotenv" ) var ( @@ -27,6 +29,7 @@ var ( // @license.url http://www.apache.org/licenses/LICENSE-2.0.html func main() { + godotenv.Load() flag.Parse() ctxBase, cancel := context.WithCancel(context.Background()) defer cancel() @@ -42,5 +45,9 @@ func main() { } defer log.Sync() + configFiles := app.ConfigFiles{ + ServerConfigFile: "configs/config.yml", + AddrAuthServer: os.Getenv("AUTH_SERVICE_HOST") + ":" + os.Getenv("AUTH_SERVICE_PORT"), // "localhost:8085", + } app.Run(ctxBase, log, configFiles) } diff --git a/internal/app/app.go b/internal/app/app.go index a561039..e8c25a4 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -5,7 +5,6 @@ import ( "os" "time" - "github.com/joho/godotenv" "github.com/microcosm-cc/bluemonday" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -47,8 +46,6 @@ var _timeoutForConnPG = 5 * time.Second const uploadFiles = "upload/" func Run(ctx context.Context, log *log.Logger, cfg ConfigFiles) { - godotenv.Load() - metrics := metrics.New("pinspire") err := metrics.Registry() if err != nil { @@ -74,7 +71,8 @@ func Run(ctx context.Context, log *log.Logger, cfg ConfigFiles) { } defer connMessMS.Close() - connRealtime, err := grpc.Dial("localhost:8090", grpc.WithTransportCredentials(insecure.NewCredentials())) + // connRealtime, err := grpc.Dial("localhost:8090", grpc.WithTransportCredentials(insecure.NewCredentials())) + connRealtime, err := grpc.Dial(os.Getenv("REALTIME_SERVICE_HOST")+":"+os.Getenv("REALTIME_SERVICE_PORT"), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Error(err.Error()) return