diff --git a/framework/Furion.Pure/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs b/framework/Furion.Pure/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs index 8911f0e7d5..acf26716e6 100644 --- a/framework/Furion.Pure/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs +++ b/framework/Furion.Pure/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs @@ -32,6 +32,7 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; @@ -663,7 +664,7 @@ public static class SpecificationDocumentBuilder { swaggerUIOptions.ConfigObject.AdditionalItems.Add(nameof(_specificationDocumentSettings.LoginInfo), new JsonObject { - [nameof(SpecificationLoginInfo.Enabled)] = additionals.Enabled, + [nameof(SpecificationLoginInfo.Enabled)] = additionals.Enabled || (App.HostEnvironment.IsProduction() && additionals.EnableOnProduction), [nameof(SpecificationLoginInfo.CheckUrl)] = additionals.CheckUrl, [nameof(SpecificationLoginInfo.SubmitUrl)] = additionals.SubmitUrl }); diff --git a/framework/Furion.Pure/SpecificationDocument/Internal/SpecificationLoginInfo.cs b/framework/Furion.Pure/SpecificationDocument/Internal/SpecificationLoginInfo.cs index f213a24f46..9b30ef36fe 100644 --- a/framework/Furion.Pure/SpecificationDocument/Internal/SpecificationLoginInfo.cs +++ b/framework/Furion.Pure/SpecificationDocument/Internal/SpecificationLoginInfo.cs @@ -45,4 +45,9 @@ public sealed class SpecificationLoginInfo /// 提交登录地址 /// public string SubmitUrl { get; set; } + + /// + /// 生产环境自动开启 + /// + public bool EnableOnProduction { get; set; } } \ No newline at end of file diff --git a/framework/Furion/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs b/framework/Furion/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs index 8911f0e7d5..acf26716e6 100644 --- a/framework/Furion/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs +++ b/framework/Furion/SpecificationDocument/Builders/SpecificationDocumentBuilder.cs @@ -32,6 +32,7 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; @@ -663,7 +664,7 @@ public static class SpecificationDocumentBuilder { swaggerUIOptions.ConfigObject.AdditionalItems.Add(nameof(_specificationDocumentSettings.LoginInfo), new JsonObject { - [nameof(SpecificationLoginInfo.Enabled)] = additionals.Enabled, + [nameof(SpecificationLoginInfo.Enabled)] = additionals.Enabled || (App.HostEnvironment.IsProduction() && additionals.EnableOnProduction), [nameof(SpecificationLoginInfo.CheckUrl)] = additionals.CheckUrl, [nameof(SpecificationLoginInfo.SubmitUrl)] = additionals.SubmitUrl }); diff --git a/framework/Furion/SpecificationDocument/Internal/SpecificationLoginInfo.cs b/framework/Furion/SpecificationDocument/Internal/SpecificationLoginInfo.cs index f213a24f46..9b30ef36fe 100644 --- a/framework/Furion/SpecificationDocument/Internal/SpecificationLoginInfo.cs +++ b/framework/Furion/SpecificationDocument/Internal/SpecificationLoginInfo.cs @@ -45,4 +45,9 @@ public sealed class SpecificationLoginInfo /// 提交登录地址 /// public string SubmitUrl { get; set; } + + /// + /// 生产环境自动开启 + /// + public bool EnableOnProduction { get; set; } } \ No newline at end of file diff --git a/schemas/v3/furion-schema.json b/schemas/v3/furion-schema.json index 727e4c14e5..643c490822 100644 --- a/schemas/v3/furion-schema.json +++ b/schemas/v3/furion-schema.json @@ -2623,6 +2623,11 @@ "Password": { "type": "string", "description": "密码" + }, + "EnableOnProduction": { + "type": "boolean", + "description": "是否生产环境自动开启", + "default": false } } }, diff --git a/schemas/v4/furion-schema.json b/schemas/v4/furion-schema.json index 727e4c14e5..643c490822 100644 --- a/schemas/v4/furion-schema.json +++ b/schemas/v4/furion-schema.json @@ -2623,6 +2623,11 @@ "Password": { "type": "string", "description": "密码" + }, + "EnableOnProduction": { + "type": "boolean", + "description": "是否生产环境自动开启", + "default": false } } },