forked from anjoy8/Blog.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppConfigSetup.cs
More file actions
105 lines (94 loc) · 3.71 KB
/
AppConfigSetup.cs
File metadata and controls
105 lines (94 loc) · 3.71 KB
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
using Blog.Core.Common;
using Blog.Core.Common.Helper;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace Blog.Core.Extensions
{
/// <summary>
/// Cors 启动服务
/// </summary>
public static class AppConfigSetup
{
public static void AddAppConfigSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
if (Appsettings.app(new string[] { "Startup", "AppConfigAlert", "Enabled" }).ObjToBool())
{
Console.WriteLine("************ Blog.Core Config Set *****************");
// 授权策略方案
if (Permissions.IsUseIds4)
{
ConsoleHelper.WriteSuccessLine($"Current authorization scheme: " + (Permissions.IsUseIds4 ? "Ids4" : "JWT"));
}
else
{
Console.WriteLine($"Current authorization scheme: " + (Permissions.IsUseIds4 ? "Ids4" : "JWT"));
}
// Redis缓存AOP
if (!Appsettings.app(new string[] { "AppSettings", "RedisCachingAOP", "Enabled" }).ObjToBool())
{
Console.WriteLine($"Redis Caching AOP: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"Redis Caching AOP: True");
}
// 内存缓存AOP
if (!Appsettings.app(new string[] { "AppSettings", "MemoryCachingAOP", "Enabled" }).ObjToBool())
{
Console.WriteLine($"Memory Caching AOP: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"Memory Caching AOP: True");
}
// 服务日志AOP
if (!Appsettings.app(new string[] { "AppSettings", "LogAOP", "Enabled" }).ObjToBool())
{
Console.WriteLine($"Service Log AOP: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"Service Log AOP: True");
}
// 事务AOP
if (!Appsettings.app(new string[] { "AppSettings", "TranAOP", "Enabled" }).ObjToBool())
{
Console.WriteLine($"Transaction AOP: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"Transaction AOP: True");
}
// 数据库Sql执行AOP
if (!Appsettings.app(new string[] { "AppSettings", "SqlAOP", "Enabled" }).ObjToBool())
{
Console.WriteLine($"DB Sql AOP: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"DB Sql AOP: True");
}
// SingnalR发送数据
if (!Appsettings.app(new string[] { "Middleware", "SignalR", "Enabled" }).ObjToBool())
{
Console.WriteLine($"SignalR send data: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"SignalR send data: True");
}
// IP限流
if (!Appsettings.app(new string[] { "IpRateLimiting", "EnableEndpointRateLimiting" }).ObjToBool())
{
Console.WriteLine($"IpRateLimiting: False");
}
else
{
ConsoleHelper.WriteSuccessLine($"IpRateLimiting: True");
}
Console.WriteLine();
}
}
}
}