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 void Init(IConfiguration configuration) { var fields = typeof(AppSettings).GetProperties(); foreach (var propertyInfo in fields) { if (propertyInfo.PropertyType == typeof(string)) { propertyInfo.SetValue(null, configuration.GetValue(propertyInfo.Name)); } else if (propertyInfo.PropertyType == typeof(int)) { propertyInfo.SetValue(null, configuration.GetValue(propertyInfo.Name)); } else if (propertyInfo.PropertyType == typeof(double)) { propertyInfo.SetValue(null, configuration.GetValue(propertyInfo.Name)); } } } } }