34 lines
1.4 KiB
C#
34 lines
1.4 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace WebAPI.Data
|
|
{
|
|
public static class AppSettings
|
|
{
|
|
public static string PterodactylAPIKey { get; private set; }
|
|
public static string PterodactylPanelURL { get; private set; }
|
|
public static string OIDCIntrospectionEndpoint { get; private set; }
|
|
public static string OIDCClientId { get; private set; }
|
|
public static string OIDCClientSecret { get; set; }
|
|
public static string OIDCUserInfoEndpoint { get; set; }
|
|
public static void Init(IConfiguration configuration)
|
|
{
|
|
var fields = typeof(AppSettings).GetProperties();
|
|
foreach (var propertyInfo in fields)
|
|
{
|
|
if (propertyInfo.PropertyType == typeof(string))
|
|
{
|
|
propertyInfo.SetValue(null, configuration.GetValue<string>(propertyInfo.Name));
|
|
}
|
|
else if (propertyInfo.PropertyType == typeof(int))
|
|
{
|
|
propertyInfo.SetValue(null, configuration.GetValue<int>(propertyInfo.Name));
|
|
}
|
|
else if (propertyInfo.PropertyType == typeof(double))
|
|
{
|
|
propertyInfo.SetValue(null, configuration.GetValue<double>(propertyInfo.Name));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |