chore: 关闭生产Swagger并移除网关转发
This commit is contained in:
@@ -23,6 +23,7 @@ using TakeoutSaaS.Shared.Web.Swagger;
|
||||
// 1. 创建构建器与日志模板
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
const string logTemplate = "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {Level:u3}] [TraceId:{TraceId}] [SpanId:{SpanId}] [Service:{Service}] {SourceContext} {Message:lj}{NewLine}{Exception}";
|
||||
var isDevelopment = builder.Environment.IsDevelopment();
|
||||
|
||||
// 2. 加载种子配置文件
|
||||
builder.Configuration
|
||||
@@ -44,14 +45,17 @@ builder.Host.UseSerilog((context, _, configuration) =>
|
||||
outputTemplate: logTemplate);
|
||||
});
|
||||
|
||||
// 4. 注册通用 Web 能力与 Swagger
|
||||
// 4. 注册通用 Web 能力,开发环境启用 Swagger
|
||||
builder.Services.AddSharedWebCore();
|
||||
builder.Services.AddSharedSwagger(options =>
|
||||
if (isDevelopment)
|
||||
{
|
||||
options.Title = "外卖SaaS - 管理后台";
|
||||
options.Description = "管理后台 API 文档";
|
||||
options.EnableAuthorization = true;
|
||||
});
|
||||
builder.Services.AddSharedSwagger(options =>
|
||||
{
|
||||
options.Title = "外卖SaaS - 管理后台";
|
||||
options.Description = "管理后台 API 文档";
|
||||
options.EnableAuthorization = true;
|
||||
});
|
||||
}
|
||||
|
||||
// 5. 注册领域与基础设施模块
|
||||
builder.Services.AddIdentityApplication();
|
||||
@@ -139,7 +143,10 @@ app.UseTenantResolution();
|
||||
app.UseSharedWebCore();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseSharedSwagger();
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSharedSwagger();
|
||||
}
|
||||
app.UseSchedulerDashboard(builder.Configuration);
|
||||
app.MapHealthChecks("/healthz");
|
||||
app.MapPrometheusScrapingEndpoint();
|
||||
|
||||
Reference in New Issue
Block a user