Test controller, appsettings, additional field for user
This commit is contained in:
29
WebAPI/Data/AppSettings.cs
Normal file
29
WebAPI/Data/AppSettings.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WebAPI.Data
|
||||
{
|
||||
public static class AppSettings
|
||||
{
|
||||
public static string PterodactylAPIKey { get; private 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,6 @@ namespace WebAPI.Data.Models
|
||||
public class User : BaseEntity
|
||||
{
|
||||
public int? PterodactylUserId { get; set; }
|
||||
public int? ExternalAuthIdentifier { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user