-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOpenJellyfishTool.cs
53 lines (41 loc) · 1.57 KB
/
OpenJellyfishTool.cs
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
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using JellyfishTool.Config;
using JellyfishTool.Modules;
using JellyfishTool.Modules.Features;
using JellyfishTool.Services;
IConfigurationBuilder builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", true, false);
IConfiguration config = builder.Build();
OpenJellyfishToolSettings settings = config
.GetSection(OpenJellyfishToolSettings.OPEN_JELLYFISH_TOOL_SECTION)
.Get<OpenJellyfishToolSettings>();
settings = ConfigService.AssertSettings(settings);
ServiceProvider provider = new ServiceCollection()
//Config
.AddSingleton(settings)
//Services
.AddSingleton<RuntimeService>()
.AddSingleton<SessionService>()
.AddTransient<ConfigService>()
.AddTransient<ProxyService>()
.AddTransient<ClientService>()
.AddTransient<LicenseService>()
.AddTransient<CertificateService>()
.AddTransient<RevocationService>()
.AddTransient<CmcService>()
//Base Modules
.AddTransient<AddressModule>()
.AddTransient<ApiKeyModule>()
.AddTransient<CryptographicModule>()
.AddTransient<MainModule>()
//Feature Modules
.AddTransient<IFeatureModule, CertificateRequestModule>()
.AddTransient<IFeatureModule, CertificateRevocationModule>()
.AddTransient<IFeatureModule, CmcCertificateRequestModule>()
.AddTransient<IFeatureModule, CmcCertificateRevocationModule>()
.AddTransient<IFeatureModule, ExitModule>()
.BuildServiceProvider();
MainModule main = provider.GetService<MainModule>();
await main.Run();