This commit is contained in:
@@ -51,12 +51,12 @@ namespace AyaNova
|
||||
//
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
_newLog.LogTrace("Initializing services...");
|
||||
_newLog.LogDebug("Initializing services...");
|
||||
|
||||
_newLog.LogTrace("Health");
|
||||
_newLog.LogDebug("Health");
|
||||
services.AddHealthChecks().AddDbContextCheck<AyContext>(); ;
|
||||
|
||||
_newLog.LogTrace("Profiler");
|
||||
_newLog.LogDebug("Profiler");
|
||||
//https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
|
||||
services.AddMemoryCache();
|
||||
services.AddMiniProfiler(options =>
|
||||
@@ -75,15 +75,15 @@ namespace AyaNova
|
||||
|
||||
|
||||
//Server state service for shutting people out of api
|
||||
_newLog.LogTrace("ServerState service");
|
||||
_newLog.LogDebug("ServerState service");
|
||||
services.AddSingleton(new AyaNova.Api.ControllerHelpers.ApiServerState());
|
||||
|
||||
|
||||
_newLog.LogTrace("Mail service");
|
||||
_newLog.LogDebug("Mail service");
|
||||
services.AddSingleton<IMailer, Mailer>();
|
||||
|
||||
//Init controllers
|
||||
_newLog.LogTrace("Controllers");
|
||||
_newLog.LogDebug("Controllers");
|
||||
var MvcBuilder = services.AddControllers(config =>
|
||||
{
|
||||
// config.Filters.Add(new AyaNova.Api.ControllerHelpers.ApiCustomExceptionFilter(AyaNova.Util.ApplicationLogging.LoggerFactory));
|
||||
@@ -100,7 +100,7 @@ namespace AyaNova
|
||||
options.SuppressModelStateInvalidFilter = true;
|
||||
});
|
||||
|
||||
_newLog.LogTrace("JSON");
|
||||
_newLog.LogDebug("JSON");
|
||||
|
||||
MvcBuilder.AddNewtonsoftJson(options =>
|
||||
{
|
||||
@@ -112,7 +112,7 @@ namespace AyaNova
|
||||
|
||||
//HTTP CLIENT FACTORY USED BY LICENSE.CS
|
||||
//https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-3.1
|
||||
_newLog.LogTrace("HTTPClientFactory");
|
||||
_newLog.LogDebug("HTTPClientFactory");
|
||||
services.AddHttpClient();
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace AyaNova
|
||||
|
||||
#endif
|
||||
|
||||
_newLog.LogTrace("EF Core");
|
||||
_newLog.LogDebug("EF Core");
|
||||
|
||||
|
||||
//change to resolve error:
|
||||
@@ -180,7 +180,7 @@ namespace AyaNova
|
||||
|
||||
|
||||
// Add service and create Policy with options
|
||||
_newLog.LogTrace("CORS");
|
||||
_newLog.LogDebug("CORS");
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("CorsPolicy",
|
||||
@@ -271,7 +271,7 @@ namespace AyaNova
|
||||
ServerBootConfig.AYANOVA_JWT_SECRET = secretKey;
|
||||
var signingKey = new SymmetricSecurityKey(System.Text.Encoding.ASCII.GetBytes(ServerBootConfig.AYANOVA_JWT_SECRET));
|
||||
|
||||
_newLog.LogTrace("Authorization");
|
||||
_newLog.LogDebug("Authorization");
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
@@ -305,7 +305,7 @@ namespace AyaNova
|
||||
|
||||
|
||||
|
||||
_newLog.LogTrace("Generator");
|
||||
_newLog.LogDebug("Generator");
|
||||
services.AddSingleton<IHostedService, GeneratorService>();
|
||||
|
||||
}
|
||||
@@ -319,7 +319,7 @@ namespace AyaNova
|
||||
AyContext dbContext, IApiVersionDescriptionProvider provider, AyaNova.Api.ControllerHelpers.ApiServerState apiServerState,
|
||||
IServiceProvider serviceProvider)
|
||||
{
|
||||
_newLog.LogTrace("Configuring request pipeline...");
|
||||
_newLog.LogDebug("Configuring request pipeline...");
|
||||
|
||||
//this *may* be useful in the event of an issue so uncomment if necessary but errors during dev are handled equally by the logging, I think
|
||||
// if (env.IsDevelopment())
|
||||
@@ -346,7 +346,7 @@ namespace AyaNova
|
||||
|
||||
|
||||
#region STATIC FILES
|
||||
_newLog.LogTrace("Static files");
|
||||
_newLog.LogDebug("Static files");
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
//Might need the following if the page doesn't update in the client properly
|
||||
@@ -364,19 +364,19 @@ namespace AyaNova
|
||||
// });
|
||||
#endregion
|
||||
|
||||
_newLog.LogTrace("Routing pipeline");
|
||||
_newLog.LogDebug("Routing pipeline");
|
||||
app.UseRouting();//this wasn't here for 2.2 but added for 3.0, needs to come before the stuff after
|
||||
|
||||
_newLog.LogTrace("CORS pipeline");
|
||||
_newLog.LogDebug("CORS pipeline");
|
||||
app.UseCors("CorsPolicy");
|
||||
|
||||
|
||||
#region AUTH / ROLES CUSTOM MIDDLEWARE
|
||||
_newLog.LogTrace("Authentication pipeline");
|
||||
_newLog.LogDebug("Authentication pipeline");
|
||||
//Use authentication middleware
|
||||
app.UseAuthentication();
|
||||
|
||||
_newLog.LogTrace("Authorization pipeline");
|
||||
_newLog.LogDebug("Authorization pipeline");
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
@@ -496,12 +496,12 @@ namespace AyaNova
|
||||
#endregion
|
||||
|
||||
|
||||
_newLog.LogTrace("Profiler");
|
||||
_newLog.LogDebug("Profiler");
|
||||
app.UseMiniProfiler();
|
||||
|
||||
|
||||
|
||||
_newLog.LogTrace("Endpoints pipeline");
|
||||
_newLog.LogDebug("Endpoints pipeline");
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHealthChecks("/health");
|
||||
@@ -510,7 +510,7 @@ namespace AyaNova
|
||||
|
||||
#region SWAGGER
|
||||
|
||||
_newLog.LogTrace("API explorer pipeline");
|
||||
_newLog.LogDebug("API explorer pipeline");
|
||||
// Enable middleware to serve generated Swagger as a JSON endpoint.
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(
|
||||
@@ -570,13 +570,13 @@ namespace AyaNova
|
||||
|
||||
|
||||
//Check schema
|
||||
_newLog.LogTrace("DB schema check");
|
||||
_newLog.LogDebug("DB schema check");
|
||||
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
||||
|
||||
|
||||
|
||||
//Check database integrity
|
||||
_newLog.LogTrace("DB integrity check");
|
||||
_newLog.LogDebug("DB integrity check");
|
||||
DbUtil.CheckFingerPrintAsync(AySchema.EXPECTED_COLUMN_COUNT,
|
||||
AySchema.EXPECTED_INDEX_COUNT,
|
||||
AySchema.EXPECTED_CHECK_CONSTRAINTS,
|
||||
@@ -589,10 +589,10 @@ namespace AyaNova
|
||||
AyaNova.Core.License.InitializeAsync(apiServerState, dbContext, _newLog).Wait();
|
||||
|
||||
//Set static global biz settings
|
||||
_newLog.LogTrace("Global settings");
|
||||
_newLog.LogDebug("Global settings");
|
||||
ServerGlobalBizSettings.Initialize(null, dbContext);
|
||||
|
||||
_newLog.LogTrace("Ops settings");
|
||||
_newLog.LogDebug("Ops settings");
|
||||
ServerGlobalOpsSettingsCache.Initialize(dbContext);
|
||||
|
||||
//Ensure translations are present, not missing any keys and that there is a server default translation that exists
|
||||
@@ -650,7 +650,7 @@ namespace AyaNova
|
||||
ServerGlobalOpsSettingsCache.BOOTING = false;
|
||||
|
||||
//Open up the server for visitors
|
||||
_newLog.LogTrace("Setting server state open");
|
||||
_newLog.LogDebug("Setting server state open");
|
||||
apiServerState.SetOpen();
|
||||
|
||||
//final startup log
|
||||
|
||||
Reference in New Issue
Block a user