Fix startup programs for deployment (#29)
All checks were successful
Game Ideas deploy / build-test-deploy (push) Successful in 1m28s

Co-authored-by: Maxime Adler <madler@sqli.com>
Reviewed-on: #29
This commit was merged in pull request #29.
This commit is contained in:
2025-04-28 14:47:56 +02:00
parent f749d6528e
commit ebb831d741
2 changed files with 13 additions and 2 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

@@ -16,7 +16,7 @@ var services = builder.Services;
#if DEBUG
LoadEnvironmentVariable("../../../../.env");
#else
LoadEnvironmentVariable(".env");
LoadEnvironmentVariable("../.env");
#endif
Action<DbContextOptionsBuilder> dbContextOptions = options =>
@@ -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.