using System.Collections.Generic; using System.Text.RegularExpressions; namespace ZhonTai.Admin.Core.Configs; /// /// 应用配置 /// public class AppConfig { public AppType AppType { get; set; } = AppType.Controllers; /// /// Api地址,默认 http://*:8000 /// public string[] Urls { get; set; } /// /// 跨域地址,默认 http://*:9000 /// public string[] CorUrls { get; set; } /// /// 程序集名称 /// public string[] AssemblyNames { get; set; } /// /// 租户类型 /// public bool Tenant { get; set; } = false; /// /// 分布式事务唯一标识 /// public string DistributeKey { get; set; } /// /// Swagger文档 /// public SwaggerConfig Swagger { get; set; } = new SwaggerConfig(); /// /// 新版Api文档 /// public ApiUIConfig ApiUI { get; set; } = new ApiUIConfig(); /// /// MiniProfiler性能分析器 /// public bool MiniProfiler { get; set; } = false; /// /// 统一认证授权服务器 /// public IdentityServer IdentityServer { get; set; } = new IdentityServer(); /// /// Aop配置 /// public AopConfig Aop { get; set; } = new AopConfig(); /// /// 日志配置 /// public LogConfig Log { get; set; } = new LogConfig(); /// /// 验证配置 /// public ValidateConfig Validate { get; set; } = new ValidateConfig(); /// /// 限流 /// public bool RateLimit { get; set; } = false; /// /// 验证码配置 /// public VarifyCodeConfig VarifyCode { get; set; } = new VarifyCodeConfig(); /// /// 默认密码 /// public string DefaultPassword { get; set; } = "111111"; /// /// 动态Api配置 /// public DynamicApiConfig DynamicApi { get; set; } = new DynamicApiConfig(); } /// /// Swagger配置 /// public class SwaggerConfig { /// /// 启用 /// public bool Enable { get; set; } = false; private string _RoutePrefix = "swagger"; /// /// 访问地址 /// public string RoutePrefix { get => Regex.Replace(_RoutePrefix, "^\\/+|\\/+$", ""); set => _RoutePrefix = value; } /// /// 地址 /// public string Url { get; set; } /// /// 项目列表 /// public List Projects { get; set; } } /// ///新版Api文档配置 /// public class ApiUIConfig { /// /// 启用 /// public bool Enable { get; set; } = false; private string _RoutePrefix=""; /// /// 访问地址 /// public string RoutePrefix { get => Regex.Replace(_RoutePrefix, "^\\/+|\\/+$", ""); set => _RoutePrefix = value; } public SwaggerFooterConfig Footer { get; set; } = new SwaggerFooterConfig(); } /// /// Swagger页脚配置 /// public class SwaggerFooterConfig { /// /// 启用 /// public bool Enable { get; set; } = false; /// /// 内容 /// public string Content { get; set; } } /// /// 统一认证授权服务器配置 /// public class IdentityServer { /// /// 启用 /// public bool Enable { get; set; } = false; /// /// 地址 /// public string Url { get; set; } = "https://localhost:5000"; } /// /// Aop配置 /// public class AopConfig { /// /// 事物 /// public bool Transaction { get; set; } = true; } /// /// 日志配置 /// public class LogConfig { /// /// 操作日志 /// public bool Operation { get; set; } = true; } /// /// 验证配置 /// public class ValidateConfig { /// /// 登录 /// public bool Login { get; set; } = true; /// /// 权限 /// public bool Permission { get; set; } = true; } /// /// 验证码配置 /// public class VarifyCodeConfig { /// /// 启用 /// public bool Enable { get; set; } = true; /// /// 操作日志 /// public string[] Fonts { get; set; }// = new[] { "Times New Roman", "Verdana", "Arial", "Gungsuh", "Impact" }; } /// /// 项目配置 /// public class ProjectConfig { /// /// 名称 /// public string Name { get; set; } /// /// 编码 /// public string Code { get; set; } /// /// 版本 /// public string Version { get; set; } /// /// 描述 /// public string Description { get; set; } } /// /// 动态api配置 /// public class DynamicApiConfig { /// /// 结果格式化 /// public bool FormatResult { get; set; } = true; } /// /// 应用程序类型 /// public enum AppType { Controllers, ControllersWithViews, MVC }