@@ -36,6 +36,8 @@ public static IServiceCollection AddSimApi(this IServiceCollection builder,
3636 {
3737 var simApiOptions = new SimApiOptions ( ) ;
3838 options ? . Invoke ( simApiOptions ) ;
39+ simApiOptions . WebConfig ??= new ( ) ;
40+ builder . AddSingleton ( simApiOptions ) ;
3941
4042 if ( simApiOptions . RedisConfiguration != null )
4143 {
@@ -350,7 +352,6 @@ string GetSimpleTypeName(Type t, int depth = 0)
350352 }
351353
352354 builder . AddSingleton ( simApiOptions . SimApiRequestLogOptions ) ;
353- builder . AddSingleton ( simApiOptions ) ;
354355 return builder ;
355356 }
356357
@@ -461,18 +462,6 @@ public static WebApplication UseSimApi(this WebApplication builder)
461462 builder . UseMiddleware < SimApiAuthMiddleware > ( ) ;
462463 }
463464
464-
465- if ( options . SimApiRouteOptions . VersionRoute != null )
466- {
467- logger . LogInformation ( "注册内置Route: Versions => {}" , options . SimApiRouteOptions . VersionRoute ) ;
468- builder . MapControllerRoute ( name : "Versions" , pattern : options . SimApiRouteOptions . VersionRoute ,
469- defaults : new
470- {
471- controller = "SimApiCommon" ,
472- action = "Versions"
473- } ) ;
474- }
475-
476465 if ( options . SimApiRouteOptions . UserInfoRoute != null )
477466 {
478467 logger . LogInformation ( "注册内置Route: UserInfo => {}" , options . SimApiRouteOptions . UserInfoRoute ) ;
@@ -495,6 +484,17 @@ public static WebApplication UseSimApi(this WebApplication builder)
495484 } ) ;
496485 }
497486
487+ if ( options . SimApiRouteOptions . WebConfigRoute != null )
488+ {
489+ logger . LogInformation ( "注册内置Route: Logout => {}" , options . SimApiRouteOptions . WebConfigRoute ) ;
490+ builder . MapControllerRoute ( name : "WebConfig" , pattern : options . SimApiRouteOptions . WebConfigRoute ,
491+ defaults : new
492+ {
493+ controller = "SimApiCommon" ,
494+ action = "WebConfig"
495+ } ) ;
496+ }
497+
498498 if ( options . EnableSimApiDoc )
499499 {
500500 logger . LogInformation ( "开始配置SimApiDoc..." ) ;
0 commit comments