From 71645a77167f7d0b80b7658425aa69a3c8b870fe Mon Sep 17 00:00:00 2001 From: cant-code Date: Thu, 2 May 2024 21:06:27 +0530 Subject: [PATCH] Update server port --- cmd/app/main.go | 2 +- config/config.yml | 4 +++- internal/configurations/config-setup.go | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/app/main.go b/cmd/app/main.go index 20d51a2..0bfc16a 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -20,7 +20,7 @@ func main() { go consumer.Consume(dependencies) h := handlers.Dependencies{DBConn: dependencies.DBConn, Auth: dependencies.Configs.Auth} - if err := http.ListenAndServe(":8080", h.ApiHandler()); err != nil { + if err := http.ListenAndServe(":"+dependencies.Configs.Server.Port, h.ApiHandler()); err != nil { log.Println(err) } } diff --git a/config/config.yml b/config/config.yml index eb61f0e..2bcd1e9 100644 --- a/config/config.yml +++ b/config/config.yml @@ -17,4 +17,6 @@ db: username: postgres password: pass auth: - url: http://localhost:8900/realms/yt-clone \ No newline at end of file + url: http://localhost:8900/realms/yt-clone +server: + port: 8090 \ No newline at end of file diff --git a/internal/configurations/config-setup.go b/internal/configurations/config-setup.go index 25771af..066212d 100644 --- a/internal/configurations/config-setup.go +++ b/internal/configurations/config-setup.go @@ -36,11 +36,14 @@ type Auth struct { } type Config struct { - MQ MQConfig - Jobs SubscriberConfig - Aws AwsConfig - DB DBConfig - Auth Auth + MQ MQConfig + Jobs SubscriberConfig + Aws AwsConfig + DB DBConfig + Auth Auth + Server struct { + Port string + } } func LoadConfig() (Config, error) {