using Znyc.CloudCar.Utility.Extensions; namespace Znyc.CloudCar.Configuration { /// /// 配置文件格式化 /// public class AppSettingsConstVars { #region 数据库 /// /// 数据库连接字符串 /// public static readonly string DbSqlConnection = AppSettingsHelper.GetContent("ConnectionStrings", "SqlConnection"); /// /// 监听操作 /// public static readonly bool SqlMonitorCommand = AppSettingsHelper.GetContent("ConnectionStrings", "SqlMonitorCommand").ObjectToBool(); /// /// 监听CURD /// public static readonly bool SqlCurd = AppSettingsHelper.GetContent("ConnectionStrings", "SqlCurd").ObjectToBool(); #endregion #region Redis /// /// 获取redis连接字符串 /// public static readonly string RedisConfigConnectionString = AppSettingsHelper.GetContent("RedisConfig", "ConnectionString"); /// /// 启用redis作为定时任务 /// public static readonly bool RedisUseTimedTask = AppSettingsHelper.GetContent("RedisConfig", "UseTimedTask").ObjectToBool(); #endregion #region Cors /// /// 跨域设置 /// public static readonly string CorsPolicyName = AppSettingsHelper.GetContent("Cors", "PolicyName"); public static readonly bool CorsEnableAllIPs = AppSettingsHelper.GetContent("Cors", "EnableAllIPs").ObjectToBool(); public static readonly string CorsIPs = AppSettingsHelper.GetContent("Cors", "IPs"); #endregion #region Jwt授权配置================================================================================ public static readonly string JwtConfigSecretKey = AppSettingsHelper.GetContent("JwtConfig", "SecretKey"); public static readonly string JwtConfigIssuer = AppSettingsHelper.GetContent("JwtConfig", "Issuer"); public static readonly string JwtConfigAudience = AppSettingsHelper.GetContent("JwtConfig", "Audience"); public static readonly int JwtConfigExpires = AppSettingsHelper.GetContent("JwtConfig", "Expires").ObjectToInt(); #endregion #region Hangfire /// /// 登陆账号 /// public static readonly string HangFireLogin = AppSettingsHelper.GetContent("HangFire", "Login"); /// /// 登陆密码 /// public static readonly string HangFirePassWord = AppSettingsHelper.GetContent("HangFire", "PassWord"); #endregion #region Middleware中间件================================================================================ /// /// Ip限流 /// public static readonly bool MiddlewareIpLogEnabled = AppSettingsHelper.GetContent("Middleware", "IPLog", "Enabled").ObjectToBool(); /// /// 记录请求与返回数据 /// public static readonly bool MiddlewareRequestResponseLogEnabled = AppSettingsHelper.GetContent("Middleware", "RequestResponseLog", "Enabled").ObjectToBool(); /// /// 用户访问记录-是否开启 /// public static readonly bool MiddlewareRecordAccessLogsEnabled = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "Enabled").ObjectToBool(); /// /// 用户访问记录-过滤ip /// public static readonly string MiddlewareRecordAccessLogsIgnoreApis = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "IgnoreApis"); #endregion #region COS配置 public static readonly string CosConfigBucket = AppSettingsHelper.GetContent("CosConfig", "bucket"); public static readonly string CosConfigRegion = AppSettingsHelper.GetContent("CosConfig", "region"); public static readonly string CosConfigAllowPrefix = AppSettingsHelper.GetContent("CosConfig", "allowPrefix"); public static readonly string[] CosConfigAllowActions = AppSettingsHelper.GetContent("CosConfig", "allowActions").Split(","); public static readonly int CosConfigDurationSeconds = AppSettingsHelper.GetContent("CosConfig", "durationSeconds").ObjectToInt(); public static readonly string CosConfigSecretId = AppSettingsHelper.GetContent("CosConfig", "secretId"); public static readonly string CosConfigSecretKey = AppSettingsHelper.GetContent("CosConfig", "secretKey"); #endregion #region 百度配置 public static readonly string AppID = AppSettingsHelper.GetContent("BaiduConfig", "AppID"); public static readonly string ApiKey = AppSettingsHelper.GetContent("BaiduConfig", "ApiKey"); public static readonly string SecretKey = AppSettingsHelper.GetContent("BaiduConfig", "SecretKey"); #endregion } }