diff --git a/.gitignore b/.gitignore index 18d1863..c6b85fb 100644 --- a/.gitignore +++ b/.gitignore @@ -113,6 +113,8 @@ pids/ .env .env.* !.env.example +!.env.staging +!.env.production # ===================================================== # IDEs and Editors @@ -185,3 +187,4 @@ docker-compose.override.yml ## Diagnostic reports report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +.vercel diff --git a/src/backend/src/FantasyRealm.Api/Program.cs b/src/backend/src/FantasyRealm.Api/Program.cs index ff66c59..b957061 100644 --- a/src/backend/src/FantasyRealm.Api/Program.cs +++ b/src/backend/src/FantasyRealm.Api/Program.cs @@ -21,11 +21,14 @@ private static void Main(string[] args) builder.Services.AddSwaggerGen(); // CORS configuration + var corsOrigins = builder.Configuration["CorsOrigins"]?.Split(',') + ?? new[] { "http://localhost:5173" }; + builder.Services.AddCors(options => { options.AddPolicy("AllowFrontend", policy => { - policy.WithOrigins("http://localhost:5173") + policy.WithOrigins(corsOrigins) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials(); diff --git a/src/frontend/.env.production b/src/frontend/.env.production new file mode 100644 index 0000000..4fb6ed4 --- /dev/null +++ b/src/frontend/.env.production @@ -0,0 +1,2 @@ +# Production environment - Railway backend (à configurer quand l'environnement de production sera créé) +# VITE_API_URL=https://fantasyrealm-api-production.up.railway.app/api diff --git a/src/frontend/.env.staging b/src/frontend/.env.staging new file mode 100644 index 0000000..1a1375d --- /dev/null +++ b/src/frontend/.env.staging @@ -0,0 +1,2 @@ +# Staging environment - Railway backend +VITE_API_URL=https://fantasyrealm-api-staging.up.railway.app/api diff --git a/src/frontend/package.json b/src/frontend/package.json index 7c9cd26..76ee472 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", + "build:staging": "tsc -b && vite build --mode staging", "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write \"src/**/*.{ts,tsx,css}\"",