121 lines
5.0 KiB

using Znyc.CloudCar.Utility.Extensions;
namespace Znyc.CloudCar.Configuration
{
/// <summary>
/// 配置文件格式化
/// </summary>
public class AppSettingsConstVars
{
#region 数据库
/// <summary>
/// 数据库连接字符串
/// </summary>
public static readonly string DbSqlConnection = AppSettingsHelper.GetContent("ConnectionStrings", "SqlConnection");
/// <summary>
/// 监听操作
/// </summary>
public static readonly bool SqlMonitorCommand = AppSettingsHelper.GetContent("ConnectionStrings", "SqlMonitorCommand").ObjectToBool();
/// <summary>
/// 监听CURD
/// </summary>
public static readonly bool SqlCurd = AppSettingsHelper.GetContent("ConnectionStrings", "SqlCurd").ObjectToBool();
#endregion
#region Redis
/// <summary>
/// 获取redis连接字符串
/// </summary>
public static readonly string RedisConfigConnectionString = AppSettingsHelper.GetContent("RedisConfig", "ConnectionString");
/// <summary>
/// 启用redis作为定时任务
/// </summary>
public static readonly bool RedisUseTimedTask = AppSettingsHelper.GetContent("RedisConfig", "UseTimedTask").ObjectToBool();
#endregion
#region Cors
/// <summary>
/// 跨域设置
/// </summary>
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
/// <summary>
/// 登陆账号
/// </summary>
public static readonly string HangFireLogin = AppSettingsHelper.GetContent("HangFire", "Login");
/// <summary>
/// 登陆密码
/// </summary>
public static readonly string HangFirePassWord = AppSettingsHelper.GetContent("HangFire", "PassWord");
#endregion
#region Middleware中间件================================================================================
/// <summary>
/// Ip限流
/// </summary>
public static readonly bool MiddlewareIpLogEnabled = AppSettingsHelper.GetContent("Middleware", "IPLog", "Enabled").ObjectToBool();
/// <summary>
/// 记录请求与返回数据
/// </summary>
public static readonly bool MiddlewareRequestResponseLogEnabled = AppSettingsHelper.GetContent("Middleware", "RequestResponseLog", "Enabled").ObjectToBool();
/// <summary>
/// 用户访问记录-是否开启
/// </summary>
public static readonly bool MiddlewareRecordAccessLogsEnabled = AppSettingsHelper.GetContent("Middleware", "RecordAccessLogs", "Enabled").ObjectToBool();
/// <summary>
/// 用户访问记录-过滤ip
/// </summary>
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
}
}