Fix programs

This commit is contained in:
Maxime Adler
2025-04-28 14:43:52 +02:00
parent f749d6528e
commit c08b6dccde
2 changed files with 12 additions and 1 deletions

View File

@@ -16,10 +16,15 @@ var services = builder.Services;
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
#if DEBUG
UriBuilder uriBuilder = new(builder.HostEnvironment.BaseAddress)
{
Port = 8000
};
#else
UriBuilder uriBuilder = new(Environment.GetEnvironmentVariable("API_URL")
?? throw new ArgumentNullException("API_URL", "Environment variable API_URL is missing"));
#endif
services.AddHttpClient(
"GameIdeas.WebAPI",

View File

@@ -89,12 +89,18 @@ services.AddControllers();
services.AddOpenApi();
services.AddCors(option => option.AddDefaultPolicy(policy =>
policy.WithOrigins("http://localhost:5172", "http://localhost:7060")
policy.AllowAnyOrigin()
.AllowAnyHeader()
.WithMethods("GET", "POST", "PUT", "DELETE")));
var app = builder.Build();
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<GameIdeasContext>();
await db.Database.MigrateAsync();
}
await LoadTranslations();
// Configure the HTTP request pipeline.