😎1、增加是否开启定时任务配置 2、整理配置文件

This commit is contained in:
zuohuaijun 2024-09-13 15:48:28 +08:00
parent ed32d75357
commit 3a9ce81b52
14 changed files with 63 additions and 53 deletions

View File

@ -1,10 +1,8 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
"Urls": "http://*:5005", //
// "https_port": 44325,
"AllowedHosts": "*",
"Urls": "http://*:5005", //
"AllowedHosts": "*", //
"AppSettings": {
"InjectSpecificationDocument": true, // Swagger
@ -30,23 +28,29 @@
"DateTimeFormatCulture": "zh-CN" //
},
"CorsAccessorSettings": {
//"PolicyName": "App.Cors.Policy",
//"WithOrigins": [ "http://localhost:5005", "https://gitee.com" ],
//"PolicyName": "App.Cors.Policy", //
//"WithOrigins": [ "http://localhost:5005", "https://gitee.com" ], //
"WithExposedHeaders": [ "Content-Disposition", "X-Pagination", "access-token", "x-access-token", "Access-Control-Expose-Headersx-access-token" ], // axios
"SignalRSupport": true // SignalR
},
// /
"ScheduleJob": {
"Enabled": true //
},
// Id
"SnowId": {
"WorkerId": 1, //
"WorkerId": 1, // Id
"WorkerIdBitLength": 6, // 6 [1, 19]
"SeqBitLength": 6, // 6 [3, 21]4Id
"WorkerPrefix": "adminnet_" //
},
//
"Cryptogram": {
"StrongPassword": false, //
"PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 6-16
"PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合长度在6-16之间", //
"CryptoType": "SM2", // MD5SM2SM4
// (http://localhost:5005/api/sysCommon/smKeyPair)VITE_SM_PUBLIC_KEY
// (http://localhost:5005/api/sysCommon/smKeyPair)VITE_SM_PUBLIC_KEY
"PublicKey": "04851D329AA3E38C2E7670AFE70E6E70E92F8769CA27C8766B12209A0FFBA4493B603EF7A0B9B1E16F0E8930C0406EA0B179B68DF28E25334BDEC4AE76D907E9E9", //
"PrivateKey": "3A61D1D30C6302DABFF36201D936D0143EEF0C850AF28C5CA6D5C045AF8C5C8A" //
}

View File

@ -1,6 +1,7 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
//
"Cache": {
"Prefix": "adminnet_", //
"CacheType": "Memory", // MemoryRedis
@ -11,7 +12,8 @@
"AutoDetect": false // Redis使false
}
},
"Cluster": { //
//
"Cluster": {
"Enabled": false, // Redis
"ServerId": "adminnet", //
"ServerIp": "", // IP

View File

@ -3,7 +3,7 @@
// -
"CodeGen": {
"EntityAssemblyNames": [ "Admin.NET.Core", "Admin.NET.Application" ], //
"EntityAssemblyNames": [ "Admin.NET.Core", "Admin.NET.Application" ], //
"BaseEntityNames": [ "EntityTenantId", "EntityTenant", "EntityTenantBaseData", "EntityBaseData", "EntityBase", "EntityBaseId" ], //
"EntityBaseColumn": {
"EntityTenantId": [ "Id", "TenantId" ],
@ -12,9 +12,8 @@
"EntityBaseData": [ "Id", "CreateTime", "UpdateTime", "CreateUserId", "UpdateUserId", "CreateUserName", "UpdateUserName", "IsDelete", "CreateOrgId", "CreateOrgName" ],
"EntityBase": [ "Id", "CreateTime", "UpdateTime", "CreateUserId", "UpdateUserId", "CreateUserName", "UpdateUserName", "IsDelete" ],
"EntityBaseId": [ "Id" ]
//"BaseId": [ "Id" ]
},
"FrontRootPath": "Web", //
"BackendApplicationNamespaces": [ "Admin.NET.Application", "Admin.NET.Application2" ] //
"BackendApplicationNamespaces": [ "Admin.NET.Application", "Admin.NET.Application2" ] //
}
}

View File

@ -9,11 +9,11 @@
{
//"ConfigId": "1300000000001", // -
"DbType": "Sqlite", // MySqlSqlServerSqliteOraclePostgreSQLDmKdbndpOscarMySqlConnectorAccessOpenGaussQuestDBHGClickHouseGBaseOdbcCustom
"ConnectionString": "DataSource=./Admin.NET.db", // Sqlite
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql ",
//"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle
//"ConnectionString": "Server=localhost;Database=xxx;User Id=xxx;Password=xxx;", // SqlServer
"ConnectionString": "DataSource=./Admin.NET.db", // Sqlite
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql,
//"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle
//"ConnectionString": "Server=localhost;Database=xxx;User Id=xxx;Password=xxx;", // SqlServer
//"SlaveConnectionConfigs": [ // /
// {
@ -26,17 +26,17 @@
// }
//],
"DbSettings": {
"EnableInitDb": true, //
"EnableInitDb": true, //
"EnableDiffLog": false, //
"EnableUnderLine": false // 线
},
"TableSettings": {
"EnableInitTable": true, //
"EnableIncreTable": false // -[IncreTable]
"EnableInitTable": true, //
"EnableIncreTable": false // [IncreTable]
},
"SeedSettings": {
"EnableInitSeed": true, //
"EnableIncreSeed": false // -[IncreSeed]
"EnableInitSeed": true, //
"EnableIncreSeed": false // [IncreSeed]
}
}
////
@ -45,17 +45,17 @@
// "DbType": "Sqlite",
// "ConnectionString": "DataSource=./Admin.NET.Log.db", //
// "DbSettings": {
// "EnableInitDb": true, //
// "EnableInitDb": true, //
// "EnableDiffLog": false, //
// "EnableUnderLine": false // 线
// },
// "TableSettings": {
// "EnableInitTable": true, //
// "EnableIncreTable": false // -[IncreTable]
// "EnableInitTable": true, //
// "EnableIncreTable": false // [IncreTable]
// },
// "SeedSettings": {
// "EnableInitSeed": false, //
// "EnableIncreSeed": false // -[IncreSeed]
// "EnableInitSeed": false, //
// "EnableIncreSeed": false // [IncreSeed]
// }
//},
////
@ -64,17 +64,17 @@
// "DbType": "Sqlite", //
// "ConnectionString": "DataSource=./Admin.NET.Test.db", //
// "DbSettings": {
// "EnableInitDb": true, //
// "EnableInitDb": true, //
// "EnableDiffLog": false, //
// "EnableUnderLine": false // 线
// },
// "TableSettings": {
// "EnableInitTable": true, //
// "EnableIncreTable": false // -[IncreTable]
// "EnableInitTable": true, //
// "EnableIncreTable": false // [IncreTable]
// },
// "SeedSettings": {
// "EnableInitSeed": true, //
// "EnableIncreSeed": false // -[IncreSeed]
// "EnableInitSeed": true, //
// "EnableIncreSeed": false // [IncreSeed]
// }
//}
]

View File

@ -1,6 +1,7 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
//
"Email": {
"Host": "smtp.163.com", //
"Port": 465, // 46599425

View File

@ -1,8 +1,8 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
//
//
"Enum": {
"EntityAssemblyNames": [ "Admin." ]
"EntityAssemblyNames": [ "Admin." ] //
}
}

View File

@ -59,7 +59,7 @@
"IpRateLimitPolicies": {
"IpRules": [
{
"Ip": "0.0.0.0", // IP"::1/10"
"Ip": "0.0.0.0", // IP"::1/10"
"Rules": [
{
"Endpoint": "*",

View File

@ -18,7 +18,7 @@
},
"Database": {
"Enabled": true, //
"MinimumLevel": "Information"
"MinimumLevel": "Information" //
},
"ElasticSearch": {
"Enabled": false, // ES

View File

@ -1,7 +1,9 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
//
"SMS": {
//
"Aliyun": {
"AccessKeyId": "",
"AccessKeySecret": "",
@ -20,6 +22,7 @@
}
]
},
//
"Tencentyun": {
"SdkAppId": "",
"AccessKeyId": "",

View File

@ -8,7 +8,7 @@
"EnableMd5": false // MDF5-
},
"OSSProvider": {
"IsEnable": false,
"Enabled": false,
"Provider": "Minio", // OSS Invalid/Minio/Aliyun/QCloud/Qiniu/HuaweiCloud
"Endpoint": "xxx.xxx.xxx.xxx:8090", // /APIOSSAppId
"Region": "xxx.xxx.xxx.xxx", //
@ -20,7 +20,7 @@
"CustomHost": "" // HostHost使Endpoint
},
"SSHProvider": {
"IsEnable": false,
"Enabled": false,
"Host": "127.0.0.1",
"Port": 8222,
"Username": "sshuser",

View File

@ -41,7 +41,7 @@
<PackageReference Include="SqlSugarCore" Version="5.1.4.167" />
<PackageReference Include="SSH.NET" Version="2024.1.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.5" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1085" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1087" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@ -43,7 +43,7 @@ public sealed class OSSProviderOptions : OSSOptions, IConfigurableOptions
/// <summary>
/// 是否启用OSS存储
/// </summary>
public bool IsEnable { get; set; }
public bool Enabled { get; set; }
/// <summary>
/// 自定义桶名称 不能直接使用Provider来替代桶名称

View File

@ -32,7 +32,7 @@ public class SysFileService : IDynamicApiController, ITransient
_sysFileRep = sysFileRep;
_OSSProviderOptions = oSSProviderOptions.Value;
_uploadOptions = uploadOptions.Value;
if (_OSSProviderOptions.IsEnable)
if (_OSSProviderOptions.Enabled)
_OSSService = ossServiceFactory.Create(Enum.GetName(_OSSProviderOptions.Provider));
}
@ -120,12 +120,12 @@ public class SysFileService : IDynamicApiController, ITransient
var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
if (_OSSProviderOptions.IsEnable)
if (_OSSProviderOptions.Enabled)
{
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
return new FileStreamResult(stream.Stream, "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
}
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
{
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
@ -152,12 +152,12 @@ public class SysFileService : IDynamicApiController, ITransient
//var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
if (_OSSProviderOptions.IsEnable)
if (_OSSProviderOptions.Enabled)
{
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
return new FileStreamResult(stream.Stream, "application/octet-stream");
}
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
{
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
@ -180,7 +180,7 @@ public class SysFileService : IDynamicApiController, ITransient
[DisplayName("下载指定文件Base64格式")]
public async Task<string> DownloadFileBase64([FromBody] string url)
{
if (_OSSProviderOptions.IsEnable)
if (_OSSProviderOptions.Enabled)
{
using var httpClient = new HttpClient();
HttpResponseMessage response = await httpClient.GetAsync(url);
@ -195,7 +195,7 @@ public class SysFileService : IDynamicApiController, ITransient
throw new HttpRequestException($"Request failed with status code: {response.StatusCode}");
}
}
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
{
var sysFile = await _sysFileRep.CopyNew().GetFirstAsync(u => u.Url == url) ?? throw Oops.Oh($"文件不存在");
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
@ -236,11 +236,11 @@ public class SysFileService : IDynamicApiController, ITransient
{
await _sysFileRep.DeleteAsync(file);
if (_OSSProviderOptions.IsEnable)
if (_OSSProviderOptions.Enabled)
{
await _OSSService.RemoveObjectAsync(file.BucketName.ToString(), string.Concat(file.FilePath, "/", $"{input.Id}{file.Suffix}"));
}
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
{
var fullPath = string.Concat(file.FilePath, "/", file.Id + file.Suffix);
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
@ -349,10 +349,10 @@ public class SysFileService : IDynamicApiController, ITransient
var newFile = new SysFile
{
Id = YitIdHelper.NextId(),
// BucketName = _OSSProviderOptions.IsEnable ? _OSSProviderOptions.Provider.ToString() : "Local",
// BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Provider.ToString() : "Local",
// 阿里云对bucket名称有要求1.只能包括小写字母,数字,短横线(-2.必须以小写字母或者数字开头 3.长度必须在3-63字节之间
// 无法使用Provider
BucketName = _OSSProviderOptions.IsEnable ? _OSSProviderOptions.Bucket : "Local",
BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Bucket : "Local",
FileName = Path.GetFileNameWithoutExtension(file.FileName),
Suffix = suffix,
SizeKb = sizeKb,
@ -363,7 +363,7 @@ public class SysFileService : IDynamicApiController, ITransient
};
var finalName = newFile.Id + suffix; // 文件最终名称
if (_OSSProviderOptions.IsEnable)
if (_OSSProviderOptions.Enabled)
{
newFile.Provider = Enum.GetName(_OSSProviderOptions.Provider);
var filePath = string.Concat(path, "/", finalName);
@ -391,7 +391,7 @@ public class SysFileService : IDynamicApiController, ITransient
break;
}
}
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
{
var fullPath = string.Concat(path.StartsWith('/') ? path : "/" + path, "/", finalName);
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],

View File

@ -68,6 +68,7 @@ public class Startup : AppStartup
// 任务调度
services.AddSchedule(options =>
{
if(App.GetConfig<bool>("Cache:Redis:AutoDetect", true))
options.AddPersistence<DbJobPersistence>(); // 添加作业持久化器
options.AddMonitor<JobMonitor>(); // 添加作业执行监视器
});