90 lines
2.9 KiB
C#
Raw Normal View History

2025-10-30 13:00:35 +08:00
using Autofac.Core;
namespace YD_XinWei.Api.Utilities
2025-01-13 21:06:59 +08:00
{
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[] CorsUrls { get; set; }
2025-07-30 14:55:00 +08:00
public static string RedisConnectionString { get; set; }
2025-01-13 21:06:59 +08:00
public static WeChatConfig WeChat { get; set; }
2025-10-30 13:00:35 +08:00
/// <summary>
/// 阿里云OSS
/// </summary>
public static ALiYunOSS ALiYunOSS { get; set; }
/// <summary>
/// YueDongServerOSS
/// </summary>
public static YueDongServerOSS YueDongServerOSS { get; set; }
2025-01-13 21:06:59 +08:00
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"];
2025-07-30 16:51:08 +08:00
RedisConnectionString = configuration["RedisConnectionString"];
2025-01-13 21:06:59 +08:00
CorsUrls = configuration["CorsUrls"].Split(',');
WeChat = configuration.GetSection("WeChat").Get<WeChatConfig>();
2025-10-30 13:00:35 +08:00
ALiYunOSS = configuration.GetSection("ALiYunOSS").Get<ALiYunOSS>();
YueDongServerOSS = configuration.GetSection("YueDongServerOSS").Get<YueDongServerOSS>();
2025-01-13 21:06:59 +08:00
}
2025-10-30 13:00:35 +08:00
}
2025-01-13 21:06:59 +08:00
2025-10-30 13:00:35 +08:00
public class LoggingConfig
{
public LogLevelConfig LogLevel { get; set; }
}
2025-01-13 21:06:59 +08:00
2025-10-30 13:00:35 +08:00
public class LogLevelConfig
{
public string Default { get; set; }
public string Microsoft { get; set; }
public string MicrosoftHostingLifetime { get; set; }
}
2025-01-13 21:06:59 +08:00
2025-10-30 13:00:35 +08:00
public class VirtualPathConfig
{
public string StaticFile { get; set; }
public string FolderName { get; set; }
}
2025-01-13 21:06:59 +08:00
2025-10-30 13:00:35 +08:00
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; }
2025-01-13 21:06:59 +08:00
}
2025-10-30 13:00:35 +08:00
public class WeChatConfig
{
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 class YueDongServerOSS
{
public string BucketName { get; set; }
public string Prefix { get; set; }
}
2025-01-13 21:06:59 +08:00
}