make metrics optional

This commit is contained in:
Gervasio Marchand 2022-12-31 07:56:21 -03:00
parent 2f587072ce
commit 900db191e8
No known key found for this signature in database
GPG Key ID: B7736CB188DD0A38

View File

@ -49,9 +49,13 @@ app.MapControllerRoute(
"default",
"{controller=Home}/{action=Index}/{id?}");
app.UseEndpoints(endpoints =>
var useMetrics = builder.Configuration.GetValue<bool?>("EXPOSE_METRICS");
if (useMetrics == true)
{
endpoints.MapMetrics();
});
app.UseEndpoints(endpoints =>
{
endpoints.MapMetrics();
});
}
app.Run();