Support Android emulator API access
Enable CORS in all environments and disable HTTPS redirect in dev. Seed the database after migrations. Make the API base URL configurable, defaulting to the Android emulator host, and use per-config Android manifests.
This commit is contained in:
@@ -98,21 +98,28 @@ var app = builder.Build();
|
||||
// Aspire Default Endpoints (Health Checks)
|
||||
app.MapDefaultEndpoints();
|
||||
|
||||
// Migrations anwenden
|
||||
// Migrations anwenden und Testdaten seeden (nur wenn die Datenbank leer ist)
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<SlipItInDbContext>();
|
||||
db.Database.Migrate();
|
||||
await DbSeeder.SeedAsync(db);
|
||||
}
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
app.UseCors("AllowAll");
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors("AllowAll");
|
||||
|
||||
// Beim Emulator/geräteübergreifenden Zugriff würde die HTTPS-Umleitung
|
||||
// den Client auf eine nicht vertrauenswürdige Dev-Zertifikats-URL schicken.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseHttpsRedirection();
|
||||
}
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user