移动系统liao
2024-06-21 b38c91e5cce54e1114ec5968c722c1a1c57bd21a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using SqlSugar.Extensions;
 
namespace CoreCms.Net.Configuration
{
    /// <summary>
    /// 配置文件格式化
    /// </summary>
    public static class AppSettingsConstVars
    {
 
        #region 全局地址================================================================================
        /// <summary>
        /// 系统后端地址
        /// </summary>
        public static readonly string AppConfigAppUrl = AppSettingsHelper.GetContent("AppConfig", "AppUrl");
        /// <summary>
        /// PC端地址
        /// </summary>
        public static readonly string AppConfigAppPcUrl = AppSettingsHelper.GetContent("AppConfig", "AppPcUrl");
        /// <summary>
        /// H5端地址
        /// </summary>
        public static readonly string AppConfigAppH5Url = AppSettingsHelper.GetContent("AppConfig", "AppH5Url");
        /// <summary>
        /// 系统接口地址
        /// </summary>
        public static readonly string AppConfigAppInterFaceUrl = AppSettingsHelper.GetContent("AppConfig", "AppInterFaceUrl");
        #endregion
 
        #region 数据库================================================================================
        /// <summary>
        /// 获取数据库连接字符串
        /// </summary>
        public static readonly string DbSqlConnection = AppSettingsHelper.GetContent("ConnectionStrings", "SqlConnection");
        /// <summary>
        /// 获取数据库类型
        /// </summary>
        public static readonly string DbDbType = AppSettingsHelper.GetContent("ConnectionStrings", "DbType");
        #endregion
 
        #region redis================================================================================
 
        /// <summary>
        /// 获取redis连接字符串
        /// </summary>
        public static readonly string RedisConfigConnectionString = AppSettingsHelper.GetContent("RedisConfig", "ConnectionString");
 
        /// <summary>
        /// 启用redis作为缓存选择
        /// </summary>
        public static readonly bool RedisUseCache = AppSettingsHelper.GetContent("RedisConfig", "UseCache").ObjToBool();
        /// <summary>
        /// 启用redis作为定时任务
        /// </summary>
        public static readonly bool RedisUseTimedTask = AppSettingsHelper.GetContent("RedisConfig", "UseTimedTask").ObjToBool();
 
        #endregion
 
        #region AOP================================================================================
        /// <summary>
        /// 事务切面开关
        /// </summary>
        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中间件================================================================================
        /// <summary>
        /// 是否记录ip信息
        /// </summary>
        public static readonly bool MiddlewareIpLogEnabled = AppSettingsHelper.GetContent("Middleware", "IPLog", "Enabled").ObjToBool();
        /// <summary>
        /// 记录请求与返回数据
        /// </summary>
        public static readonly bool MiddlewareRequestResponseLogEnabled = AppSettingsHelper.GetContent("Middleware", "RequestResponseLog", "Enabled").ObjToBool();
        /// <summary>
        /// 用户访问记录-是否开启
        /// </summary>
        public static readonly bool MiddlewareRecordAccessLogsEnabled = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "Enabled").ObjToBool();
        /// <summary>
        /// 用户访问记录-过滤ip
        /// </summary>
        public static readonly string MiddlewareRecordAccessLogsIgnoreApis = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "IgnoreApis");
        /// <summary>
        /// 是否开启记录到文件模式
        /// </summary>
        public static readonly bool MiddlewareRecordAccessLogsEnabledFileMode = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "EnabledFileMode").ObjToBool();
        /// <summary>
        /// 是否开启记录到数据库模式
        /// </summary>
        public static readonly bool MiddlewareRecordAccessLogsEnabledDbMode = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "EnabledDbMode").ObjToBool();
        #endregion
 
        #region HangFire定时任务================================================================================
        /// <summary>
        /// 登录账号
        /// </summary>
        public static readonly string HangFireLogin = AppSettingsHelper.GetContent("HangFire", "Login");
        /// <summary>
        /// 登录密码
        /// </summary>
        public static readonly string HangFirePassWord = AppSettingsHelper.GetContent("HangFire", "PassWord");
        /// <summary>
        /// 已经完成的任务过期时间,单位分钟(默认10080,7天时间)
        /// </summary>
        public static readonly int HangFireJobExpirationTimeOut = AppSettingsHelper.GetContent("HangFire", "JobExpirationTimeOut").ObjToInt(10080);
 
 
        #endregion
 
        #region 微信配置================================================================================
 
        /// <summary>
        /// 微信小程序WxOpenAppSecret
        /// </summary>
        public static readonly string WxOpenAppId = AppSettingsHelper.GetContent("WeChatOptions", "WxOpenAppId");
        /// <summary>
        /// 微信小程序WxOpenAppSecret
        /// </summary>
        public static readonly string WxOpenAppSecret = AppSettingsHelper.GetContent("WeChatOptions", "WxOpenAppSecret");
 
        /// <summary>
        /// 微信公众号WeiXinAppId
        /// </summary>
        public static readonly string WeiXinAppId = AppSettingsHelper.GetContent("WeChatOptions", "WeiXinAppId");
        /// <summary>
        /// 微信公众号WeiXinAppSecret
        /// </summary>
        public static readonly string WeiXinAppSecret = AppSettingsHelper.GetContent("WeChatOptions", "WeiXinAppSecret");
 
 
        #endregion
 
        #region Swagger授权访问设置
        /// <summary>
        /// Swagger文档默认访问路由地址
        /// </summary>
        public static readonly string SwaggerRoutePrefix = AppSettingsHelper.GetContent("SwaggerConfig", "RoutePrefix");
 
        /// <summary>
        /// Swagger文档登录账号
        /// </summary>
        public static readonly string SwaggerUserName = AppSettingsHelper.GetContent("SwaggerConfig", "UserName");
 
        /// <summary>
        /// Swagger文档登录密码
        /// </summary>
        public static readonly string SwaggerPassWord = AppSettingsHelper.GetContent("SwaggerConfig", "PassWord");
 
 
        #endregion
 
    }
}