Added environment manager and updated UI

This commit is contained in:
2026-06-24 19:23:50 +02:00
parent 594834908c
commit 0614ae82f5
7 changed files with 783 additions and 98 deletions
@@ -166,6 +166,29 @@ namespace EonaCat.DoxaApi.Middleware
});
}
// Add analytics endpoint if metrics collector is registered
if (metricsCollector != null)
{
app.Map($"{prefix}/analytics", analyticsApp =>
{
analyticsApp.Run(async context =>
{
if (!HttpMethods.IsGet(context.Request.Method))
{
context.Response.StatusCode = 405;
context.Response.Headers["Allow"] = "GET";
await context.Response.WriteAsync("Method Not Allowed - use GET");
return;
}
var dashboard = metricsCollector.GetDashboard();
context.Response.ContentType = "application/json; charset=utf-8";
var json = JsonHelper.ToJson(dashboard, _writeOptions);
await context.Response.WriteAsync(json, Encoding.UTF8);
});
});
}
app.Map(prefix, uiApp =>
{
uiApp.Run(async context =>
@@ -203,29 +226,6 @@ namespace EonaCat.DoxaApi.Middleware
});
});
// Add analytics endpoint if metrics collector is registered
if (metricsCollector != null)
{
app.Map(prefix + "/analytics", analyticsApp =>
{
analyticsApp.Run(async context =>
{
if (!HttpMethods.IsGet(context.Request.Method))
{
context.Response.StatusCode = 405;
context.Response.Headers["Allow"] = "GET";
await context.Response.WriteAsync("Method Not Allowed - use GET");
return;
}
var dashboard = metricsCollector.GetDashboard();
context.Response.ContentType = "application/json; charset=utf-8";
var json = JsonHelper.ToJson(dashboard, _writeOptions);
await context.Response.WriteAsync(json, Encoding.UTF8);
});
});
}
return app;
}