107 lines
3.5 KiB
C#
107 lines
3.5 KiB
C#
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; }
|
|
|
|
/// <summary>
|
|
/// 微信公众号
|
|
/// </summary>
|
|
public static WeChatQA WeChatQA { get; set; }
|
|
|
|
/// <summary>
|
|
/// 阿里云OSS
|
|
/// </summary>
|
|
public static ALiYunOSS ALiYunOSS { get; set; }
|
|
|
|
/// <summary>
|
|
/// YDWeChatAppletOSS
|
|
/// </summary>
|
|
public static YDWeChatAppletOSS YDWeChatAppletOSS { get; set; }
|
|
|
|
|
|
public static string TokenHeaderName = "Authorization";
|
|
|
|
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"];
|
|
RedisConnectionString = configuration["RedisConnectionString"];
|
|
SmartSportsString = configuration["SmartSportsString"];
|
|
CorsUrls = configuration["CorsUrls"].Split(',');
|
|
WeChat = configuration.GetSection("WeChat").Get<WeChatConfig>();
|
|
ALiYunOSS = configuration.GetSection("ALiYunOSS").Get<ALiYunOSS>();
|
|
WeChatQA = configuration.GetSection("WeChatQA").Get<WeChatQA>();
|
|
YDWeChatAppletOSS = configuration.GetSection("YDWeChatAppletOSS").Get<YDWeChatAppletOSS>();
|
|
}
|
|
|
|
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; }
|
|
}
|
|
}
|