diff --git a/backend/src/server/server.go b/backend/src/server/server.go index ec803622b..278cbf3d6 100644 --- a/backend/src/server/server.go +++ b/backend/src/server/server.go @@ -27,7 +27,7 @@ import ( // @BasePath / // @schemes http https func Init(db *gorm.DB, settings config.Settings) *fiber.App { - app := newFiberApp() + app := newFiberApp(settings.Application) validate, err := utilities.RegisterCustomValidators() if err != nil { @@ -51,14 +51,14 @@ func Init(db *gorm.DB, settings config.Settings) *fiber.App { return app } -func newFiberApp() *fiber.App { +func newFiberApp(appSettings config.ApplicationSettings) *fiber.App { app := fiber.New(fiber.Config{ JSONEncoder: json.Marshal, JSONDecoder: json.Unmarshal, }) app.Use(cors.New(cors.Config{ - AllowOrigins: "http://localhost:8080", + AllowOrigins: fmt.Sprintf("http://%s:%d", appSettings.Host, appSettings.Port), AllowCredentials: true, })) app.Use(requestid.New())