diff --git a/compose.yml b/go-backend/compose.yml similarity index 92% rename from compose.yml rename to go-backend/compose.yml index 0a0344f..a8c7da9 100644 --- a/compose.yml +++ b/go-backend/compose.yml @@ -1,6 +1,6 @@ services: app: - build: ./go-backend + build: . container_name: carsharingBackend ports: - "8080:8080" diff --git a/go-backend/internal/config/config.go b/go-backend/internal/config/config.go index d8be5de..4147684 100644 --- a/go-backend/internal/config/config.go +++ b/go-backend/internal/config/config.go @@ -95,9 +95,9 @@ var environmentOptions map[string]bool = map[string]bool{ // It also generates JWT and CSRF secrets. Returns a Config pointer or an error if any step fails. func LoadConfig() { CFGPath = os.Getenv("CONFIG_FILE_PATH") - logger.Info.Printf("Config file environment: %v", CFGPath) readFile(&CFG) readEnv(&CFG) + logger.Info.Printf("Config file environment: %v", CFGPath) csrfSecret, err := utils.GenerateRandomString(32) if err != nil { logger.Error.Fatalf("could not generate CSRF secret: %v", err) diff --git a/go-backend/internal/middlewares/cors.go b/go-backend/internal/middlewares/cors.go index 422d49c..21bcd09 100644 --- a/go-backend/internal/middlewares/cors.go +++ b/go-backend/internal/middlewares/cors.go @@ -2,7 +2,6 @@ package middlewares import ( "GoMembership/internal/config" - "GoMembership/pkg/logger" "strings" "github.com/gin-contrib/cors" @@ -10,13 +9,13 @@ import ( ) func CORSMiddleware() gin.HandlerFunc { - logger.Info.Print("Applying CORS") return cors.New(cors.Config{ - AllowOrigins: strings.Split(config.Site.AllowOrigins, ","), - AllowMethods: []string{"GET", "POST", "PATCH", "PUT", "OPTIONS"}, - AllowHeaders: []string{"Origin", "Content-Type", "Accept", "Authorization", "X-Requested-With", "X-CSRF-Token"}, - ExposeHeaders: []string{"Content-Length"}, - AllowCredentials: true, - MaxAge: 12 * 60 * 60, // 12 hours + AllowOrigins: strings.Split(config.Site.AllowOrigins, ","), + AllowMethods: []string{"GET", "POST", "PATCH", "PUT", "OPTIONS"}, + AllowHeaders: []string{"Origin", "Content-Type", "Accept", "Authorization", "X-Requested-With", "X-CSRF-Token"}, + ExposeHeaders: []string{"Content-Length"}, + AllowCredentials: true, + AllowPrivateNetwork: true, + MaxAge: 12 * 60 * 60, // 12 hours }) }