From 529f979d66b640447411c6bbc3026b1332d55d12 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 18 Oct 2019 19:58:45 +0000 Subject: [PATCH] --- server/AyaNova/Startup.cs | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index a53accd7..5e793517 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -1,47 +1,31 @@ -using Microsoft.AspNetCore.Mvc; +using System.IO; +using System.Reflection; +using System.Linq; +using System; +using System.Collections.Generic; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.ApiExplorer; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.Logging; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.IdentityModel.Tokens; using Microsoft.Extensions.Hosting; using Microsoft.AspNetCore.Http; - using Microsoft.OpenApi.Models; - using Microsoft.Extensions.Options; -using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; - using AyaNova.Models; using AyaNova.Util; using AyaNova.Generator; using AyaNova.Biz; - -using Swashbuckle.AspNetCore.SwaggerUI; - -using System.IO; -using System.Reflection; -using System.Linq; -using System; -using System.Collections.Generic; -using Newtonsoft.Json.Serialization; - - namespace AyaNova { - public class Startup { - - ///////////////////////////////////////////////////////////// // public Startup(ILogger logger, ILoggerFactory logFactory, Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment) @@ -151,7 +135,6 @@ namespace AyaNova #endregion - // Add service and create Policy with options _log.LogDebug("BOOT: init CORS service"); services.AddCors(options => @@ -177,12 +160,10 @@ namespace AyaNova options.ReportApiVersions = true; }); services.AddVersionedApiExplorer(options => options.GroupNameFormat = "'v'VVV"); - services.AddTransient, ConfigureSwaggerOptions>(); services.AddSwaggerGen( c => { - // integrate xml comments c.IncludeXmlComments(XmlCommentsFilePath); @@ -212,7 +193,6 @@ namespace AyaNova #endregion - #region JWT AUTHENTICATION //get the key if specified var secretKey = ServerBootConfig.AYANOVA_JWT_SECRET; @@ -270,7 +250,6 @@ namespace AyaNova _log.LogDebug("BOOT: init Generator service"); services.AddSingleton(); - } @@ -478,9 +457,7 @@ namespace AyaNova static string XmlCommentsFilePath { get - { - //Obsolete, used new method: https://developers.de/blogs/holger_vetter/archive/2017/06/30/swagger-includexmlcomments-platformservices-obsolete-replacement.aspx - //var basePath = PlatformServices.Default.Application.ApplicationBasePath; + { var basePath = AppContext.BaseDirectory; var fileName = typeof(Startup).GetTypeInfo().Assembly.GetName().Name + ".xml"; return Path.Combine(basePath, fileName);