64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
namespace YD_XinWei.Api.Utilities
|
|
{
|
|
public static class AppSettings
|
|
{
|
|
public static LoggingConfig Logging { get; set; }
|
|
public static VirtualPathConfig VirtualPath { get; set; }
|
|
public static SecretConfig Secret { get; set; }
|
|
public static string ExpMinutes { get; set; }
|
|
|
|
public static string DbConnectionString { get; set; }
|
|
public static string SmartSportsString { get; set; }
|
|
public static string RedisConnectionString { get; set; }
|
|
public static string[] CorsUrls { get; set; }
|
|
public static WeChatConfig WeChat { get; set; }
|
|
|
|
public static void Init(IConfiguration configuration)
|
|
{
|
|
Logging = configuration.GetSection("Logging").Get<LoggingConfig>();
|
|
VirtualPath = configuration.GetSection("VirtualPath").Get<VirtualPathConfig>();
|
|
Secret = configuration.GetSection("Secret").Get<SecretConfig>();
|
|
ExpMinutes = configuration["ExpMinutes"];
|
|
DbConnectionString = configuration["DbConnectionString"];
|
|
SmartSportsString = configuration["SmartSportsString"];
|
|
CorsUrls = configuration["CorsUrls"].Split(',');
|
|
WeChat = configuration.GetSection("WeChat").Get<WeChatConfig>();
|
|
}
|
|
|
|
public class LoggingConfig
|
|
{
|
|
public LogLevelConfig LogLevel { get; set; }
|
|
}
|
|
|
|
public class LogLevelConfig
|
|
{
|
|
public string Default { get; set; }
|
|
public string Microsoft { get; set; }
|
|
public string MicrosoftHostingLifetime { get; set; }
|
|
}
|
|
|
|
public class VirtualPathConfig
|
|
{
|
|
public string StaticFile { get; set; }
|
|
public string FolderName { get; set; }
|
|
}
|
|
|
|
public class SecretConfig
|
|
{
|
|
public string JWT { get; set; }
|
|
public string Audience { get; set; }
|
|
public string Issuer { get; set; }
|
|
public string User { get; set; }
|
|
public string DB { get; set; }
|
|
public string Redis { get; set; }
|
|
}
|
|
|
|
public class WeChatConfig
|
|
{
|
|
public string Appid { get; set; }
|
|
public string Secret { get; set; }
|
|
}
|
|
}
|
|
|
|
}
|