made RenderMode configurable

This commit is contained in:
Shaun Walker
2021-05-30 15:37:23 -04:00
parent afcc5e2170
commit 276817c89d
8 changed files with 67 additions and 18 deletions

View File

@ -20,10 +20,23 @@ namespace Oqtane.Infrastructure
return _config.GetSection(key);
}
public string GetSetting(string sectionKey, string settingKey, string defaultValue)
public T GetSetting<T>(string sectionKey, T defaultValue)
{
var value = _config.GetSection(sectionKey).GetValue(settingKey, defaultValue);
if (string.IsNullOrEmpty(value)) value = defaultValue;
return GetSetting(sectionKey, "", defaultValue);
}
public T GetSetting<T>(string sectionKey, string settingKey, T defaultValue)
{
T value;
if (!string.IsNullOrEmpty(settingKey))
{
value = _config.GetSection(sectionKey).GetValue(settingKey, defaultValue);
}
else
{
value = _config.GetValue(sectionKey, defaultValue);
}
if (value == null) value = defaultValue;
return value;
}