From f64802eec5cff7073196a2f37a71ee0eb30bdf99 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sun, 27 Oct 2024 18:40:39 -0400 Subject: [PATCH] enable hf dashboard --- rubberduckvba.Server/Program.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rubberduckvba.Server/Program.cs b/rubberduckvba.Server/Program.cs index 4538a10..5baf81c 100644 --- a/rubberduckvba.Server/Program.cs +++ b/rubberduckvba.Server/Program.cs @@ -1,4 +1,6 @@ using Hangfire; +using Hangfire.Annotations; +using Hangfire.Dashboard; using Hangfire.SqlServer; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Options; @@ -18,6 +20,11 @@ namespace rubberduckvba.com.Server; +public class HangfireAuthenticationFilter : IDashboardAuthorizationFilter +{ + public bool Authorize([NotNull] DashboardContext context) => true; +} + public class Program { public static void Main(string[] args) @@ -120,7 +127,7 @@ private static void StartHangfire(WebApplication app) hangfireOptions.UpdateXmldocContentSchedule); } - app.UseHangfireDashboard(HangfireConstants.DashboardUrl, storage: scheduler.Storage); + app.UseHangfireDashboard(HangfireConstants.DashboardUrl, new DashboardOptions { DarkModeEnabled = true, Authorization = [new HangfireAuthenticationFilter()] }, scheduler.Storage); CleanStartHangfire(scheduler.Storage); } }