tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
SetupApplication.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.Extensions.Configuration;
4using Microsoft.Extensions.DependencyInjection;
5using Microsoft.Extensions.Hosting;
6using Serilog.Events;
7
14
16{
20 public class SetupApplication
21 {
25 protected IConfiguration Configuration { get; }
26
31 public SetupApplication(IConfiguration configuration)
32 {
33 Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
34 }
35
42 public void ConfigureServices(IServiceCollection services, IAssemblyInformationProvider assemblyInformationProvider, IIOManager ioManager)
43 {
44 ArgumentNullException.ThrowIfNull(services);
45 ArgumentNullException.ThrowIfNull(assemblyInformationProvider);
46 ArgumentNullException.ThrowIfNull(ioManager);
47
48 services.SetupLogging(config => config.MinimumLevel.Override("Microsoft", LogEventLevel.Warning));
49
50 services.AddSingleton(ioManager);
51 services.AddSingleton(assemblyInformationProvider);
52
53 services.AddSingleton<IConsole, IO.Console>();
55 services.AddSingleton<IPlatformIdentifier, PlatformIdentifier>();
56 services.AddSingleton<IAsyncDelayer, AsyncDelayer>();
57
58 // these configs are what's injected into PostSetupServices
59 services.UseStandardConfig<GeneralConfiguration>(Configuration);
60 services.UseStandardConfig<DatabaseConfiguration>(Configuration);
61 services.UseStandardConfig<SecurityConfiguration>(Configuration);
62 services.UseStandardConfig<FileLoggingConfiguration>(Configuration);
63 services.UseStandardConfig<ElasticsearchConfiguration>(Configuration);
64 services.UseStandardConfig<InternalConfiguration>(Configuration);
65
66 ConfigureHostedService(services);
67 }
68
73 protected virtual void ConfigureHostedService(IServiceCollection services)
74 {
75 services.AddSingleton<IPostSetupServices, PostSetupServices>();
76 services.AddSingleton<IHostedService, SetupWizard>();
77 }
78 }
79}
Configuration options for the Database.DatabaseContext.
Configuration options pertaining to elasticsearch log storage.
Unstable configuration options used internally by TGS.
Configuration options pertaining to user security.
DI root for configuring a SetupWizard.
virtual void ConfigureHostedService(IServiceCollection services)
Configures the IHostedService.
void ConfigureServices(IServiceCollection services, IAssemblyInformationProvider assemblyInformationProvider, IIOManager ioManager)
Configure dependency injected services.
SetupApplication(IConfiguration configuration)
Initializes a new instance of the SetupApplication class.
IConfiguration Configuration
The IConfiguration for the SetupApplication.
Abstraction for global::System.Console.
Definition IConsole.cs:10
Interface for using filesystems.
Definition IIOManager.cs:13
Set of objects needed to configure an Core.Application.
For identifying the current platform.