4444using Microsoft . AspNetCore . Http ;
4545using Microsoft . Extensions . DependencyInjection ;
4646using Microsoft . Extensions . Logging ;
47+ using Microsoft . OpenApi ;
4748using Microsoft . OpenApi . Models ;
4849using Serilog ;
4950
@@ -156,13 +157,14 @@ private async Task StartHttpServer(List<BaseHttpHandler> baseHandler, Func<strin
156157 app . UseSwagger ( ) ;
157158 app . UseSwaggerUI ( options =>
158159 {
159- options . SwaggerEndpoint ( string . Format ( LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . HttpServer . SwaggerEndpointFormat ) , openApiInfo . Version ) , openApiInfo . Title ) ;
160- options . RoutePrefix = LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . HttpServer . SwaggerRoutePrefix ) ;
160+ var swaggerEndpoint = LocalizationService . GetString ( Localization . Keys . StartUp . HttpServer . SwaggerEndpointFormat , openApiInfo . Version ) ;
161+ options . SwaggerEndpoint ( swaggerEndpoint , openApiInfo . Title ) ;
162+ options . RoutePrefix = LocalizationService . GetString ( Localization . Keys . StartUp . HttpServer . SwaggerRoutePrefix ) ;
161163 } ) ;
162164
163165 foreach ( var ip in ipList )
164166 {
165- LogHelper . Debug ( LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . HttpServer . SwaggerUiAccess , ip , Setting . HttpPort ) ) ;
167+ LogHelper . Debug ( LocalizationService . GetString ( Localization . Keys . StartUp . HttpServer . SwaggerUiAccess , ip , Setting . HttpPort ) ) ;
166168 }
167169 }
168170
@@ -178,15 +180,15 @@ private async Task StartHttpServer(List<BaseHttpHandler> baseHandler, Func<strin
178180 app . MapPrometheusScrapingEndpoint ( ) ;
179181 foreach ( var ip in ipList )
180182 {
181- LogHelper . Info ( LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . PrometheusMetricsEndpointEnabledInline , ip , Setting . HttpPort ) ) ;
183+ LogHelper . Info ( LocalizationService . GetString ( Localization . Keys . StartUp . PrometheusMetricsEndpointEnabledInline , ip , Setting . HttpPort ) ) ;
182184 }
183185 }
184186 else if ( Setting . IsOpenTelemetry && Setting . IsOpenTelemetryMetrics && Setting . MetricsPort > 0 )
185187 {
186- LogHelper . Info ( LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . PrometheusMetricsServiceOnStandalonePort , Setting . MetricsPort ) ) ;
188+ LogHelper . Info ( LocalizationService . GetString ( Localization . Keys . StartUp . PrometheusMetricsServiceOnStandalonePort , Setting . MetricsPort ) ) ;
187189 foreach ( var ip in ipList )
188190 {
189- LogHelper . Info ( LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . PrometheusMetricsEndpointEnabled , ip , Setting . MetricsPort ) ) ;
191+ LogHelper . Info ( LocalizationService . GetString ( Localization . Keys . StartUp . PrometheusMetricsEndpointEnabled , ip , Setting . MetricsPort ) ) ;
190192 }
191193 }
192194
@@ -210,8 +212,8 @@ private async Task StartHttpServer(List<BaseHttpHandler> baseHandler, Func<strin
210212 // 开发模式,启用 Swagger
211213 route . WithOpenApi ( operation =>
212214 {
213- operation . Summary = LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . HttpServer . HandlePostRequest ) ;
214- operation . Description = LocalizationService . GetString ( GameFrameX . Localization . Keys . StartUp . HttpServer . HandleGameClientPostRequest ) ;
215+ operation . Summary = LocalizationService . GetString ( Localization . Keys . StartUp . HttpServer . HandlePostRequest ) ;
216+ operation . Description = LocalizationService . GetString ( Localization . Keys . StartUp . HttpServer . HandleGameClientPostRequest ) ;
215217 return operation ;
216218 } ) ;
217219 }
0 commit comments