using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SqlSugar.Extensions; namespace CoreCms.Net.Configuration { /// /// 配置文件格式化 /// public class AppSettingsConstVars { #region 全局地址================================================================================ /// /// 系统后端地址 /// public static readonly string AppConfigAppUrl = AppSettingsHelper.GetContent("AppConfig", "AppUrl"); /// /// 系统接口地址 /// public static readonly string AppConfigAppInterFaceUrl = AppSettingsHelper.GetContent("AppConfig", "AppInterFaceUrl"); #endregion #region 数据库================================================================================ /// /// 获取数据库连接字符串 /// public static readonly string DbSqlConnection = AppSettingsHelper.GetContent("ConnectionStrings", "SqlConnection"); /// /// 获取数据库类型 /// public static readonly string DbDbType = AppSettingsHelper.GetContent("ConnectionStrings", "DbType"); #endregion #region redis================================================================================ /// /// 获取redis连接字符串 /// public static readonly string RedisConfigConnectionString = AppSettingsHelper.GetContent("RedisConfig", "ConnectionString"); /// /// 启用redis作为缓存选择 /// public static readonly bool RedisUseCache = AppSettingsHelper.GetContent("RedisConfig", "UseCache").ObjToBool(); /// /// 启用redis作为定时任务 /// public static readonly bool RedisUseTimedTask = AppSettingsHelper.GetContent("RedisConfig", "UseTimedTask").ObjToBool(); #endregion #region AOP================================================================================ /// /// 事务切面开关 /// public static readonly bool TranAopEnabled = AppSettingsHelper.GetContent("TranAOP", "Enabled").ObjToBool(); #endregion #region Jwt授权配置================================================================================ public static readonly string JwtConfigSecretKey = AppSettingsHelper.GetContent("JwtConfig", "SecretKey") + AppSettingsHelper.GetMachineRandomKey(DbSqlConnection + AppSettingsHelper.GetMACIp(true)); public static readonly string JwtConfigIssuer = !string.IsNullOrEmpty(AppSettingsHelper.GetContent("JwtConfig", "Issuer")) ? AppSettingsHelper.GetContent("JwtConfig", "Issuer") : AppSettingsHelper.GetHostName(); public static readonly string JwtConfigAudience = AppSettingsHelper.GetContent("JwtConfig", "Audience"); #endregion #region Cors跨域设置================================================================================ public static readonly string CorsPolicyName = AppSettingsHelper.GetContent("Cors", "PolicyName"); public static readonly bool CorsEnableAllIPs = AppSettingsHelper.GetContent("Cors", "EnableAllIPs").ObjToBool(); public static readonly string CorsIPs = AppSettingsHelper.GetContent("Cors", "IPs"); #endregion #region Middleware中间件================================================================================ /// /// Ip限流 /// public static readonly bool MiddlewareIpLogEnabled = AppSettingsHelper.GetContent("Middleware", "IPLog", "Enabled").ObjToBool(); /// /// 记录请求与返回数据 /// public static readonly bool MiddlewareRequestResponseLogEnabled = AppSettingsHelper.GetContent("Middleware", "RequestResponseLog", "Enabled").ObjToBool(); /// /// 用户访问记录-是否开启 /// public static readonly bool MiddlewareRecordAccessLogsEnabled = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "Enabled").ObjToBool(); /// /// 用户访问记录-过滤ip /// public static readonly string MiddlewareRecordAccessLogsIgnoreApis = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "IgnoreApis"); #endregion #region 支付================================================================================ /// /// 微信支付回调 /// public static readonly string PayCallBackWeChatPayUrl = AppSettingsHelper.GetContent("PayCallBack", "WeChatPayUrl"); /// /// 微信退款回调 /// public static readonly string PayCallBackWeChatRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "WeChatRefundUrl"); /// /// 支付宝支付回调 /// public static readonly string PayCallBackAlipayUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayUrl"); /// /// 支付宝退款回调 /// public static readonly string PayCallBackAlipayRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayRefundUrl"); #endregion #region 易联云打印机================================================================================ /// /// 是否开启 /// public static readonly bool YiLianYunConfigEnabled = AppSettingsHelper.GetContent("YiLianYunConfig", "Enabled").ObjToBool(); /// /// 应用ID /// public static readonly string YiLianYunConfigClientId = AppSettingsHelper.GetContent("YiLianYunConfig", "ClientId"); /// /// 应用密钥 /// public static readonly string YiLianYunConfigClientSecret = AppSettingsHelper.GetContent("YiLianYunConfig", "ClientSecret"); /// /// 打印机设备号 /// public static readonly string YiLianYunConfigMachineCode = AppSettingsHelper.GetContent("YiLianYunConfig", "MachineCode"); /// /// 打印机终端密钥 /// public static readonly string YiLianYunConfigMsign = AppSettingsHelper.GetContent("YiLianYunConfig", "Msign"); /// /// 打印机名称 /// public static readonly string YiLianYunConfigPrinterName = AppSettingsHelper.GetContent("YiLianYunConfig", "PrinterName"); /// /// 打印机设置联系方式 /// public static readonly string YiLianYunConfigPhone = AppSettingsHelper.GetContent("YiLianYunConfig", "Phone"); #endregion #region HangFire定时任务================================================================================ /// /// HangFire默认访问路由地址 /// public static readonly string HangFireRoutePrefix = AppSettingsHelper.GetContent("HangFire", "RoutePrefix"); /// /// 登录账号 /// public static readonly string HangFireLogin = AppSettingsHelper.GetContent("HangFire", "Login"); /// /// 登录密码 /// public static readonly string HangFirePassWord = AppSettingsHelper.GetContent("HangFire", "PassWord"); /// /// 已经完成的任务过期时间,单位分钟(默认10080,7天时间) /// public static readonly int HangFireJobExpirationTimeOut = AppSettingsHelper.GetContent("HangFire", "JobExpirationTimeOut").ObjToInt(10080); #endregion #region Swagger授权访问设置 /// /// Swagger文档默认访问路由地址 /// public static readonly string SwaggerRoutePrefix = AppSettingsHelper.GetContent("SwaggerConfig", "RoutePrefix"); /// /// Swagger文档登录账号 /// public static readonly string SwaggerUserName = AppSettingsHelper.GetContent("SwaggerConfig", "UserName"); /// /// Swagger文档登录密码 /// public static readonly string SwaggerPassWord = AppSettingsHelper.GetContent("SwaggerConfig", "PassWord"); #endregion } }