cicd
This commit is contained in:
25
PARR.API/Installers/CorsInstaller.cs
Normal file
25
PARR.API/Installers/CorsInstaller.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using PARR.API.Settings;
|
||||
|
||||
namespace PARR.API.Installers
|
||||
{
|
||||
public static class CorsInstaller
|
||||
{
|
||||
public static void InstallCorsServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddCors();
|
||||
}
|
||||
|
||||
public static void InstallCors(this WebApplication app, WebApplicationBuilder builder)
|
||||
{
|
||||
var corsSettings = new CorsSettings();
|
||||
builder.Configuration.GetSection(nameof(CorsSettings)).Bind(corsSettings);
|
||||
|
||||
app.UseCors(opt =>
|
||||
opt.WithOrigins(corsSettings.AllowHostsArray)
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user