namespace YD_WeChatApplet.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 RedisConnectionString { get; set; }
public static string SmartSportsString { get; set; }
public static string[] CorsUrls { get; set; }
public static WeChatConfig WeChat { get; set; }
///
/// 微信公众号
///
public static WeChatQA WeChatQA { get; set; }
///
/// 阿里云OSS
///
public static ALiYunOSS ALiYunOSS { get; set; }
///
/// YDWeChatAppletOSS
///
public static YDWeChatAppletOSS YDWeChatAppletOSS { get; set; }
public static string TokenHeaderName = "Authorization";
public static void Init(IConfiguration configuration)
{
Logging = configuration.GetSection("Logging").Get();
VirtualPath = configuration.GetSection("VirtualPath").Get();
Secret = configuration.GetSection("Secret").Get();
ExpMinutes = configuration["ExpMinutes"];
DbConnectionString = configuration["DbConnectionString"];
RedisConnectionString = configuration["RedisConnectionString"];
SmartSportsString = configuration["SmartSportsString"];
CorsUrls = configuration["CorsUrls"].Split(',');
WeChat = configuration.GetSection("WeChat").Get();
ALiYunOSS = configuration.GetSection("ALiYunOSS").Get();
WeChatQA = configuration.GetSection("WeChatQA").Get();
YDWeChatAppletOSS = configuration.GetSection("YDWeChatAppletOSS").Get();
}
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; }
}
}
public class WeChatQA
{
public string Appid { get; set; }
public string Secret { get; set; }
}
public class ALiYunOSS
{
public string AccessKeyId { get; set; }
public string SecretAccessKey { get; set; }
public string Endpoint { get; set; }
public string CategoryImgUrl { get; set; }
}
public class YDWeChatAppletOSS
{
public string BucketName { get; set; }
public string Prefix { get; set; }
}
}