Start Job Cleanup Service

This commit is contained in:
2025-08-04 16:27:25 -07:00
parent bdc5b346a8
commit 109306dda2
2 changed files with 39 additions and 2 deletions
+10 -2
View File
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Cryptography;
using BoredCareers.Services.TimerService;
var builder = WebApplication.CreateBuilder(args);
@@ -35,8 +36,15 @@ string? _dbpass = Environment.GetEnvironmentVariable("MySQLPass");
string dbPass = !string.IsNullOrEmpty(_dbpass) ? _dbpass : "oasv34$8gpv023dd";
// Create the database serivice
DatabaseService databaseService = new DatabaseService(connectionString: "server=" + dbserver + ";user=" + dbUser + ";database=" + dbdatabase + ";password=" + dbPass + ";port=3306;");
builder.Services.Add( new ServiceDescriptor( typeof( DatabaseService ), databaseService ) );
builder.Services.AddSingleton<DatabaseService>(sp =>
new DatabaseService("server=" + dbserver + ";user=" + dbUser + ";database=" + dbdatabase + ";password=" + dbPass + ";port=3306;")
);
////////////////////////////////
/////// Timer Service ///////
////////////////////////////////
builder.Services.AddHostedService<JobCleanupService>();
////////////////////////////////
///////// Email Service ////////