From 11d3adf8dbb25060c19354f1d980300e708430f0 Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Fri, 7 Apr 2023 15:11:19 +0700 Subject: [PATCH] add port to config --- cmd/valera/main.go | 5 ++--- internal/config/config.go | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/valera/main.go b/cmd/valera/main.go index 55c5cee..98a4584 100644 --- a/cmd/valera/main.go +++ b/cmd/valera/main.go @@ -92,9 +92,8 @@ func run() { _, _ = fmt.Fprintf(w, `{"result":"ok"}`) }) - port := ":10002" - log.Println("Server is start up! port", port) - log.Fatal(http.ListenAndServe(port, nil)) + log.Println("Server is start up! port", cfg.Port) + log.Fatal(http.ListenAndServe(cfg.Port, nil)) }() for update := range updates { diff --git a/internal/config/config.go b/internal/config/config.go index 4dfd70a..7b96739 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -6,6 +6,7 @@ import ( ) type AppConfig struct { + Port string MongoConfig *MongoConfig TgConfig *TgConfig } @@ -42,6 +43,7 @@ func NewAppConfig() *AppConfig { token = strings.ReplaceAll(token, "\n", "") return &AppConfig{ + Port: ":10002", MongoConfig: &MongoConfig{ URL: mongoURL, DBName: dbName,