SwaggerDoc改用配置方式

This commit is contained in:
falcon 2020-04-26 14:49:31 +08:00
parent d8124d4a61
commit 717092bce3
3 changed files with 23 additions and 7 deletions

View File

@ -27,4 +27,10 @@
<ProjectReference Include="..\FAuth.Database\FAuth.DataBase.csproj" /> <ProjectReference Include="..\FAuth.Database\FAuth.DataBase.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Tools\" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project> </Project>

View File

@ -65,13 +65,14 @@ namespace FAuth
//×¢²áSwagger //×¢²áSwagger
services.AddSwaggerGen(c => { services.AddSwaggerGen(c => {
var option = this.Configuration.GetSection("SwaggerDoc");
c.SwaggerDoc("V1",new OpenApiInfo { c.SwaggerDoc("V1",new OpenApiInfo {
Title = "接口文档", Title = option.GetValue<string>("Title"),
Version = "1.0", Version = option.GetValue<string>("Version"),
Description = "api", Description = option.GetValue<string>("Description"),
Contact = new OpenApiContact { Contact = new OpenApiContact {
Name = "Falcon", Name = option.GetValue<string>("Contact:Name"),
Url = new Uri("http://39.105.71.191/Falcon/FAuth"), Url = new Uri(option.GetValue<string>("Contact:Url")),
}, },
}); });
var xmlPath = Path.Combine(AppContext.BaseDirectory,typeof(Program).Assembly.GetName().Name + ".xml"); var xmlPath = Path.Combine(AppContext.BaseDirectory,typeof(Program).Assembly.GetName().Name + ".xml");

View File

@ -1,4 +1,4 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
@ -19,5 +19,14 @@
"UserTicketDecryptorOption": { "UserTicketDecryptorOption": {
"Key": "abcd" "Key": "abcd"
}, },
"urls": "http://*:9000;https://*:9001" "urls": "http://*:9000;https://*:9001",
"SwaggerDoc": {
"Title": "Falcon SSO 统一登录接口文档",
"Version": "1.0",
"Description": "统一采用API接口设计查下下面详细接口规范。",
"Contact": {
"Name": "技术支持(点击链接,发布工单)",
"Url": "http://39.105.71.191/Falcon/FalconSSO/issues"
}
}
} }