LANCommander/LANCommander.Server/Startup/Hangfire.cs
2025-03-11 21:21:16 -05:00

31 lines
No EOL
883 B
C#

using Hangfire;
namespace LANCommander.Server.Startup;
public static class Hangfire
{
public static WebApplicationBuilder AddHangfire(this WebApplicationBuilder builder)
{
builder.Services.AddHangfire(static (sp, configuration) =>
{
var logger = sp.GetRequiredService<ILogger<Program>>();
logger.LogDebug("Initializing Hangfire");
configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseInMemoryStorage();
});
builder.Services.AddHangfireServer();
return builder;
}
public static WebApplication UseHangfire(this WebApplication app)
{
app.UseHangfireDashboard();
return app;
}
}