This commit is contained in:
2020-06-04 21:00:40 +00:00
parent bcd70aae20
commit f0a5300787
6 changed files with 53 additions and 19 deletions

View File

@@ -49,22 +49,25 @@ namespace AyaNova
{
_newLog.LogDebug("Initializing services...");
// _newLog.LogDebug("Profiler");
// //https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
// services.AddMemoryCache();
// services.AddMiniProfiler(options =>
// {
// options.RouteBasePath = "/profiler";
// //in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
// options.IgnorePath("/auth").IgnorePath("/user").IgnorePath("/docs");
// options.ResultsAuthorize = request =>
// {
// if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
// return true;
// return false;
// };
// //options.ShouldProfile = request => false;
// }).AddEntityFramework();
_newLog.LogDebug("Health");
services.AddHealthChecks().AddDbContextCheck<AyContext>();;
_newLog.LogDebug("Profiler");
//https://dotnetthoughts.net/using-miniprofiler-in-aspnetcore-webapi/
services.AddMemoryCache();
services.AddMiniProfiler(options =>
{
options.RouteBasePath = "/profiler";
//in testing only ignorepaths was reliable and worked and docs say it prevents any profiling at all
options.IgnorePath("/auth").IgnorePath("/license").IgnorePath("/user").IgnorePath("/docs");
options.ResultsAuthorize = request =>
{
if (request.HttpContext.Items["AY_PROFILER_ALLOWED"] != null)
return true;
return false;
};
}).AddEntityFramework();
//Server state service for shutting people out of api
@@ -474,13 +477,14 @@ namespace AyaNova
_newLog.LogDebug("Profiler");
// app.UseMiniProfiler();
app.UseMiniProfiler();
_newLog.LogDebug("Endpoints pipeline");
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
endpoints.MapControllers();
});