make cors origin configurable

This commit is contained in:
john 2025-05-18 01:09:34 +02:00
parent 7ab9f46e64
commit b4edb6ae83

View file

@ -40,6 +40,7 @@ builder.Services.InitializeAuthenticationModule(connectionString, eventBus);
builder.Services.AddScoped<CurrentUserContext, CurrentUserContext>();
builder.Services.AddScoped<ICurrentUserContext>(s => s.GetRequiredService<CurrentUserContext>());
builder.Services.AddCors(options =>
{
options.AddPolicy(
@ -48,7 +49,7 @@ builder.Services.AddCors(options =>
{
b.AllowAnyHeader()
.AllowAnyMethod()
.WithOrigins("http://localhost:5173")
.WithOrigins(builder.Configuration.GetValue<string>("CorsOrigins")?.Split(';') ?? [])
.AllowCredentials();
}
);