Refactored a few more methods that rely on the IConfiguration object to use IConfigHelper instead.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-11-25 08:40:14 -07:00
parent d4dda481be
commit 230433f784
7 changed files with 17 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ namespace CarCareTracker.Helper
{
OpenIDConfig GetOpenIDConfig();
ReminderUrgencyConfig GetReminderUrgencyConfig();
MailConfig GetMailConfig();
UserConfig GetUserConfig(ClaimsPrincipal user);
bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData);
bool AuthenticateRootUser(string username, string password);
@@ -65,6 +66,11 @@ namespace CarCareTracker.Helper
ReminderUrgencyConfig reminderUrgencyConfig = _config.GetSection("ReminderUrgencyConfig").Get<ReminderUrgencyConfig>() ?? new ReminderUrgencyConfig();
return reminderUrgencyConfig;
}
public MailConfig GetMailConfig()
{
MailConfig mailConfig = _config.GetSection("MailConfig").Get<MailConfig>() ?? new MailConfig();
return mailConfig;
}
public string GetLogoUrl()
{
var logoUrl = CheckString("LUBELOGGER_LOGO_URL", "/defaults/lubelogger_logo.png");
@@ -107,7 +113,7 @@ namespace CarCareTracker.Helper
}
public string GetServerPostgresConnection()
{
var postgresConnection = CheckString("POSTGRES_CONNECTION")
var postgresConnection = CheckString("POSTGRES_CONNECTION");
return postgresConnection;
}
public bool GetServerEnableShopSupplies()

View File

@@ -18,12 +18,12 @@ namespace CarCareTracker.Helper
private readonly IFileHelper _fileHelper;
private readonly ILogger<MailHelper> _logger;
public MailHelper(
IConfiguration config,
IConfigHelper config,
IFileHelper fileHelper,
ILogger<MailHelper> logger
) {
//load mailConfig from Configuration
mailConfig = config.GetSection("MailConfig").Get<MailConfig>() ?? new MailConfig();
mailConfig = config.GetMailConfig();
_fileHelper = fileHelper;
_logger = logger;
}