chore(codebase): full cleanup pass
This commit is contained in:
@@ -18,14 +18,17 @@ using NSwag;
|
||||
using NSwag.Generation.AspNetCore.Processors;
|
||||
using NSwag.Generation.Processors.Security;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
if (!builder.Environment.IsDevelopment())
|
||||
{
|
||||
var vaultUri = Environment.GetEnvironmentVariable("VaultUri");
|
||||
|
||||
if (vaultUri is null) throw new InvalidOperationException("Missing VaultUri configuration setting");
|
||||
|
||||
string? vaultUri = Environment.GetEnvironmentVariable("VaultUri");
|
||||
|
||||
if (vaultUri is null)
|
||||
{
|
||||
throw new InvalidOperationException("Missing VaultUri configuration setting");
|
||||
}
|
||||
|
||||
builder.Configuration.AddAzureKeyVault(new Uri(vaultUri), new DefaultAzureCredential());
|
||||
}
|
||||
|
||||
@@ -60,15 +63,16 @@ builder.Services.AddOpenApiDocument((
|
||||
Type = OpenApiSecuritySchemeType.ApiKey,
|
||||
Name = "Authorization",
|
||||
In = OpenApiSecurityApiKeyLocation.Header,
|
||||
Description = "Type into the textbox: Bearer {your JWT token}.",
|
||||
Description = "Type into the textbox: Bearer {your JWT token}."
|
||||
});
|
||||
|
||||
configure.OperationProcessors.Add(new AspNetCoreOperationTagsProcessor());
|
||||
configure.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("JWT"));
|
||||
});
|
||||
|
||||
var postgresConnectionString = builder.Configuration.GetConnectionString("PostgresConnection")
|
||||
?? throw new InvalidOperationException("Missing ConnectionStrings:PostgresConnection");
|
||||
string postgresConnectionString = builder.Configuration.GetConnectionString("PostgresConnection")
|
||||
?? throw new InvalidOperationException(
|
||||
"Missing ConnectionStrings:PostgresConnection");
|
||||
|
||||
builder.Services.AddFastEndpoints();
|
||||
builder.AddInfrastructureModule();
|
||||
@@ -84,10 +88,9 @@ builder.AddContentModule(options =>
|
||||
options.UseNpgsql(
|
||||
postgresConnectionString,
|
||||
o => o.MigrationsHistoryTable("__EFMigrationsHistory", ContentsDbContext.SchemaName)));
|
||||
builder.AddMembershipModule(
|
||||
options => options.UseNpgsql(
|
||||
postgresConnectionString,
|
||||
o => o.MigrationsHistoryTable("__EFMigrationsHistory", MembershipsDbContext.SchemaName)));
|
||||
builder.AddMembershipModule(options => options.UseNpgsql(
|
||||
postgresConnectionString,
|
||||
o => o.MigrationsHistoryTable("__EFMigrationsHistory", MembershipsDbContext.SchemaName)));
|
||||
builder.AddTippingModule(options =>
|
||||
options.UseNpgsql(
|
||||
postgresConnectionString,
|
||||
@@ -97,7 +100,7 @@ builder.AddMessagingModule(options =>
|
||||
postgresConnectionString,
|
||||
o => o.MigrationsHistoryTable("__EFMigrationsHistory", MessagingDbContext.SchemaName)));
|
||||
|
||||
var app = builder.Build();
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
app.UseForwardedHeaders(
|
||||
new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedProto }
|
||||
|
||||
Reference in New Issue
Block a user