1
0

2 Commits e4ca4659de ... 25dfc206a7

Autor SHA1 Nachricht Datum
  Dmitriy Gnatenko 25dfc206a7 Update config vor 2 Monaten
  Dmitriy Gnatenko e4ca4659de Update config vor 2 Monaten
3 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. BIN
      build/app/app
  2. 3 1
      cmd/app/main.go
  3. 3 3
      internal/services/config/config.go

BIN
build/app/app


+ 3 - 1
cmd/app/main.go

@@ -2,6 +2,7 @@ package main
 
 import (
 	"log"
+	"strconv"
 	"time"
 
 	_ "github.com/lib/pq"
@@ -26,7 +27,8 @@ func main() {
 		log.Fatal(err)
 	}
 
-	if err = fiberApp.Listen(":" + serviceProvider.ConfigService().AppPort()); err != nil {
+	port := strconv.FormatUint(uint64(serviceProvider.ConfigService().AppPort()), 10)
+	if err = fiberApp.Listen(":" + port); err != nil {
 		log.Fatal(err)
 	}
 }

+ 3 - 3
internal/services/config/config.go

@@ -10,7 +10,7 @@ import (
 const defaultConfigPath = "./.env"
 
 type Service struct {
-	appPort               string
+	appPort               uint16
 	dbDriver              string
 	dbHost                string
 	dbPort                uint16
@@ -60,7 +60,7 @@ func Init() (*Service, error) {
 	}
 
 	s := struct {
-		AppPort               string        `mapstructure:"APP_PORT"`
+		AppPort               uint16        `mapstructure:"APP_PORT"`
 		DBDriver              string        `mapstructure:"DB_DRIVER"`
 		DBHost                string        `mapstructure:"DB_HOST"`
 		DBPort                uint16        `mapstructure:"DB_PORT"`
@@ -130,7 +130,7 @@ func Init() (*Service, error) {
 	}, nil
 }
 
-func (e *Service) AppPort() string {
+func (e *Service) AppPort() uint16 {
 	return e.appPort
 }