47 lines
930 B
C#
47 lines
930 B
C#
using Asp.Versioning.ApiExplorer;
|
|
using Scalar.AspNetCore;
|
|
using Vegasco.Server.Api.Endpoints;
|
|
using Vegasco.Server.ServiceDefaults;
|
|
|
|
namespace Vegasco.Server.Api.Common;
|
|
|
|
internal static class StartupExtensions
|
|
{
|
|
internal static WebApplication ConfigureServices(this WebApplicationBuilder builder)
|
|
{
|
|
builder.AddServiceDefaults();
|
|
|
|
builder.Configuration.AddEnvironmentVariables("Vegasco_");
|
|
|
|
builder.AddApiServices();
|
|
|
|
WebApplication app = builder.Build();
|
|
return app;
|
|
}
|
|
|
|
internal static WebApplication ConfigureRequestPipeline(this WebApplication app)
|
|
{
|
|
app.UseRequestLocalization(o =>
|
|
{
|
|
o.ApplyCurrentCultureToResponseHeaders = true;
|
|
});
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.MapHealthChecks("/health");
|
|
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
|
|
app.MapEndpoints();
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.MapOpenApi();
|
|
app.MapScalarApiReference();
|
|
}
|
|
|
|
return app;
|
|
}
|
|
}
|