From e77e8dae56c90198fe458c34909a41657c36f7e4 Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Sat, 16 Jan 2021 12:40:14 +0000 Subject: [PATCH 01/14] Yaml config files --- README.md | 12 ++++++------ build/Version.props | 2 +- src/Tgstation.Server.Host/ServerFactory.cs | 6 +++++- src/Tgstation.Server.Host/Setup/SetupWizard.cs | 14 +++++++++----- .../Tgstation.Server.Host.csproj | 1 + 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 36be4c01b0..cc7de2d763 100644 --- a/README.md +++ b/README.md @@ -78,19 +78,19 @@ Note that this container is meant to be long running. Updates are handled intern Note that automatic configuration reloading is currently not supported in the container. See #1143 -If using manual configuration, before starting your container make sure the aforementioned `appsettings.Production.json` is setup properly. See below +If using manual configuration, before starting your container make sure the aforementioned `appsettings.Production.yml` is setup properly. See below ### Configuring -The first time you run TGS4 you should be prompted with a configuration wizard which will guide you through setting up your appsettings.Production.json +The first time you run TGS4 you should be prompted with a configuration wizard which will guide you through setting up your `appsettings.Production.yml` -This wizard will, generally, run whenever the server is launched without detecting the config json. Follow the instructions below to perform this process manually. +This wizard will, generally, run whenever the server is launched without detecting the config yml. Follow the instructions below to perform this process manually. #### Configuration Methods There are 3 primary supported ways to configure TGS: -- Modify the `appsettings.Production.json` file (Recommended). +- Modify the `appsettings.Production.yml` file (Recommended). - Set environment variables in the form `Section__Subsection=value` or `Section__ArraySubsection__0=value` for arrays. - Set command line arguments in the form `--Section:Subsection=value` or `--Section:ArraySubsection:0=value` for arrays. @@ -98,7 +98,7 @@ The latter two are not recommended as they cannot be dynamically changed at runt #### Manual Configuration -Create an `appsettings.Production.json` file next to `appsettings.json`. This will override the default settings in appsettings.json with your production settings. There are a few keys meant to be changed by hosts. Modifying any config files while the server is running will trigger a safe restart (Keeps DreamDaemon instances running). Note these are all case-sensitive: +Create an `appsettings.Production.yml` file next to `appsettings.json`. This will override the default settings in `appsettings.json` with your production settings. There are a few keys meant to be changed by hosts. Modifying any config files while the server is running will trigger a safe restart (Keeps DreamDaemon instances running). Note these are all case-sensitive: - `General:ConfigVersion`: Suppresses warnings about out of date config versions. You should change this after updating TGS to one with a new config version. The current version can be found on the releases page for your server version (This field did not exist before v4.4.0). @@ -250,7 +250,7 @@ var/global/client_count = 0 ## Remote Access -tgstation-server is an [ASP.Net Core](https://docs.microsoft.com/en-us/aspnet/core/) app based on the Kestrel web server. This section is meant to serve as a general use case overview, but the entire Kestrel configuration can be modified to your liking with the configuration JSON. See [the official documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel) for details. +tgstation-server is an [ASP.Net Core](https://docs.microsoft.com/en-us/aspnet/core/) app based on the Kestrel web server. This section is meant to serve as a general use case overview, but the entire Kestrel configuration can be modified to your liking with the configuration YAML. See [the official documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel) for details. Exposing the builtin Kestrel server to the internet directly over HTTP is highly not reccommended due to the lack of security. The recommended way to expose tgstation-server to the internet is to host it through a reverse proxy with HTTPS support. Here are some step by step examples to achieve this for major web servers. diff --git a/build/Version.props b/build/Version.props index 222901410b..e51d2af857 100644 --- a/build/Version.props +++ b/build/Version.props @@ -4,7 +4,7 @@ 4.7.0 - 2.2.0 + 2.3.0 8.1.1 9.1.1 5.2.10 diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index 55bbd24e3a..72d601c73d 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -49,7 +49,11 @@ namespace Tgstation.Server.Host var basePath = IOManager.ResolvePath(); IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((context, configuration) => configuration.SetBasePath(basePath)); + .ConfigureAppConfiguration((context, builder) => { + builder.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true) + .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); //Allow both appsettings.json and appsettings.yml for backwards compat + + }); var setupWizardHostBuilder = CreateDefaultBuilder() .UseSetupApplication(); diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs index 6a7c99e03b..927cb43982 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs @@ -22,6 +22,7 @@ using Tgstation.Server.Host.Core; using Tgstation.Server.Host.Database; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.System; +using YamlDotNet.Serialization; namespace Tgstation.Server.Host.Setup { @@ -841,8 +842,11 @@ namespace Tgstation.Server.Host.Setup { SwarmConfiguration.Section, swarmConfiguration }, }; - var json = JsonConvert.SerializeObject(map, Formatting.Indented); - var configBytes = Encoding.UTF8.GetBytes(json); + var serializer = new SerializerBuilder().Build(); + + var serializedYaml = serializer.Serialize(map); + + var configBytes = Encoding.UTF8.GetBytes(serializedYaml); reloadTcs = new TaskCompletionSource(); @@ -863,9 +867,9 @@ namespace Tgstation.Server.Host.Setup { await console.WriteAsync(e.Message, true, cancellationToken).ConfigureAwait(false); await console.WriteAsync(null, true, cancellationToken).ConfigureAwait(false); - await console.WriteAsync("For your convienence, here's the json we tried to write out:", true, cancellationToken).ConfigureAwait(false); + await console.WriteAsync("For your convienence, here's the yaml we tried to write out:", true, cancellationToken).ConfigureAwait(false); await console.WriteAsync(null, true, cancellationToken).ConfigureAwait(false); - await console.WriteAsync(json, true, cancellationToken).ConfigureAwait(false); + await console.WriteAsync(serializedYaml, true, cancellationToken).ConfigureAwait(false); await console.WriteAsync(null, true, cancellationToken).ConfigureAwait(false); await console.WriteAsync("Press any key to exit...", true, cancellationToken).ConfigureAwait(false); await console.PressAnyKeyAsync(cancellationToken).ConfigureAwait(false); @@ -930,7 +934,7 @@ namespace Tgstation.Server.Host.Setup return; } - var userConfigFileName = String.Format(CultureInfo.InvariantCulture, "appsettings.{0}.json", hostingEnvironment.EnvironmentName); + var userConfigFileName = String.Format(CultureInfo.InvariantCulture, "appsettings.{0}.yml", hostingEnvironment.EnvironmentName); async Task HandleSetupCancel() { diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 3951c10411..b322b33c24 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -83,6 +83,7 @@ + From 89d4781a79e60740d39ab4f53869ab688c7a570f Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Sat, 16 Jan 2021 16:47:30 +0000 Subject: [PATCH 02/14] Cybertweaks --- README.md | 23 +++---- docs/Architecture.dox | 2 +- .../Tgstation.Server.Host.Watchdog.csproj | 2 +- .../Watchdog.cs | 8 +-- .../Configuration/README.md | 4 +- src/Tgstation.Server.Host/README.md | 2 +- src/Tgstation.Server.Host/ServerFactory.cs | 3 +- .../Setup/SetupWizard.cs | 1 - .../Tgstation.Server.Host.csproj | 7 +- src/Tgstation.Server.Host/appsettings.json | 66 ------------------- src/Tgstation.Server.Host/appsettings.yml | 52 +++++++++++++++ 11 files changed, 77 insertions(+), 93 deletions(-) delete mode 100644 src/Tgstation.Server.Host/appsettings.json create mode 100644 src/Tgstation.Server.Host/appsettings.yml diff --git a/README.md b/README.md index 30268af309..e6fc63514e 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ The latter two are not recommended as they cannot be dynamically changed at runt #### Manual Configuration -Create an `appsettings.Production.yml` file next to `appsettings.json`. This will override the default settings in `appsettings.json` with your production settings. There are a few keys meant to be changed by hosts. Modifying any config files while the server is running will trigger a safe restart (Keeps DreamDaemon instances running). Note these are all case-sensitive: +Create an `appsettings.Production.yml` file next to `appsettings.yml`. This will override the default settings in `appsettings.yml` with your production settings. There are a few keys meant to be changed by hosts. Modifying any config files while the server is running will trigger a safe restart (Keeps DreamDaemon instances running). Note these are all case-sensitive: - `General:ConfigVersion`: Suppresses warnings about out of date config versions. You should change this after updating TGS to one with a new config version. The current version can be found on the releases page for your server version (This field did not exist before v4.4.0). @@ -141,19 +141,14 @@ Create an `appsettings.Production.yml` file next to `appsettings.json`. This wil - `Swarm:Identifier` should be set uniquely on all swarmed servers. Used to identify the current server. This is also used to select which instances exist on the current machine and should not be changed post-setup. - `Security:OAuth:`: Sets the OAuth client ID and secret for a given ``. The currently supported providers are `GitHub`, `Discord`, and `TGForums`. Setting these fields to `null` disables logins with the provider, but does not stop users from associating their accounts using the API. Sample Entry: -```json -{ - "Security": { - "OAuth": { - "Keycloak": { - "ClientId": "...", - "ClientSecret": "...", - "RedirectUrl": "...", - "ServerUrl": "..." - } - } - } -} +```yml +Security: + OAuth: + Keycloak: + ClientId: "..." + ClientSecret: "..." + RedirectUrl: "..." + ServerUrl: "..." ``` The following providers use the `RedirectUrl` setting: diff --git a/docs/Architecture.dox b/docs/Architecture.dox index b13c7de06e..e45b40ad70 100644 --- a/docs/Architecture.dox +++ b/docs/Architecture.dox @@ -23,7 +23,7 @@ This is a second process spawned by the Host Watchdog which facilitates the vast The server's entrypoint is in the @ref Tgstation.Server.Host.Program class. This class mainly determines if the Host watchdog is present and creates and runs the @ref Tgstation.Server.Host.Server class. That class then builds an ASP.NET Core web host using the @ref Tgstation.Server.Host.Core.Application class. -The @ref Tgstation.Server.Host.Core.Application class has two methods called by the framework. First the @ref Tgstation.Server.Host.Core.Application.ConfigureServices method sets up dependency injection of interfaces for Controllers, the @ref Tgstation.Server.Host.Database.DatabaseContext, and the component factories of the server. The framework handles constructing these things once the application starts. Configuration is loaded from the appropriate appSettings.json into the @ref Tgstation.Server.Host.Configuration classes for injection as well. Then @ref Tgstation.Server.Host.Core.Application.Configure method is run which sets up the web request pipeline which currently has the following stack of handlers: +The @ref Tgstation.Server.Host.Core.Application class has two methods called by the framework. First the @ref Tgstation.Server.Host.Core.Application.ConfigureServices method sets up dependency injection of interfaces for Controllers, the @ref Tgstation.Server.Host.Database.DatabaseContext, and the component factories of the server. The framework handles constructing these things once the application starts. Configuration is loaded from the appropriate appSettings.yml into the @ref Tgstation.Server.Host.Configuration classes for injection as well. Then @ref Tgstation.Server.Host.Core.Application.Configure method is run which sets up the web request pipeline which currently has the following stack of handlers: - Catch any exceptions and respond with 500 and detailed HTML error page - Respond with 503 if the application is still starting or shutting down diff --git a/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj b/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj index dc6ff60c72..c2d59ccd7a 100644 --- a/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj +++ b/src/Tgstation.Server.Host.Watchdog/Tgstation.Server.Host.Watchdog.csproj @@ -33,7 +33,7 @@ - + PreserveNewest diff --git a/src/Tgstation.Server.Host.Watchdog/Watchdog.cs b/src/Tgstation.Server.Host.Watchdog/Watchdog.cs index 4f2e4ae68d..d9ab43cfb6 100644 --- a/src/Tgstation.Server.Host.Watchdog/Watchdog.cs +++ b/src/Tgstation.Server.Host.Watchdog/Watchdog.cs @@ -96,10 +96,10 @@ namespace Tgstation.Server.Host.Watchdog foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories)) File.Copy(newPath, newPath.Replace(sourcePath, defaultAssemblyPath), true); - const string AppSettingsJson = "appsettings.json"; - var rootJson = Path.Combine(rootLocation, AppSettingsJson); - File.Delete(rootJson); - File.Move(Path.Combine(defaultAssemblyPath, AppSettingsJson), rootJson); + const string AppSettingsYaml = "appsettings.yml"; + var rootYaml = Path.Combine(rootLocation, AppSettingsYaml); + File.Delete(rootYaml); + File.Move(Path.Combine(defaultAssemblyPath, AppSettingsYaml), rootYaml); } else Directory.CreateDirectory(assemblyStoragePath); diff --git a/src/Tgstation.Server.Host/Configuration/README.md b/src/Tgstation.Server.Host/Configuration/README.md index 50f05e1290..83fdf539b9 100644 --- a/src/Tgstation.Server.Host/Configuration/README.md +++ b/src/Tgstation.Server.Host/Configuration/README.md @@ -1,5 +1,5 @@ # Configuration Classes -These types map directly to the settings used in the [appsettings.json](../appsettings.json) file and its derivatives. See the [Microsoft Docs on the ASP .NET Core configuration system](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1) for details. +These types map directly to the settings used in the [appsettings.yml](../appsettings.yml) file and its derivatives. See the [Microsoft Docs on the ASP .NET Core configuration system](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1) for details. -When making changes here, it's important to also update the config version in [build/Version.props](../../../build/Version.props) according to semver semantics. You'll also need to update the constant in [GeneralConfiguration.cs](./GeneralConfigration.cs). \ No newline at end of file +When making changes here, it's important to also update the config version in [build/Version.props](../../../build/Version.props) according to semver semantics. You'll also need to update the constant in [GeneralConfiguration.cs](./GeneralConfigration.cs). diff --git a/src/Tgstation.Server.Host/README.md b/src/Tgstation.Server.Host/README.md index 83f08f4798..5f1aeca63c 100644 --- a/src/Tgstation.Server.Host/README.md +++ b/src/Tgstation.Server.Host/README.md @@ -25,7 +25,7 @@ Here's a breakdown of things in this directory - [.config](./.config) contains the dotnet-tools.json. At the time of writing, this is only used to set the version of the [dotnet ef tools](https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/) used to create database migrations. - [ClientApp](./ClientApp) contains scripts to build and deploy the web control panel with TGS. - [Components](./Components) is where the bulk of the TGS implementation lives. -- [Configuration](./Configuration) contains classes that partly make up the configuration json files (i.e. [appsettings.json](./appsettings.json)). +- [Configuration](./Configuration) contains classes that partly make up the configuration yaml files (i.e. [appsettings.yml](./appsettings.yml)). - [Controllers](./Controllers) is where HTTP API code lives and bridges it with component code. - [Core](./Core) contains [Application.cs](./Core/Application.cs) and other various helpers that don't belong anywhere else. - [Database](./Database) contains all database related code. diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index 72d601c73d..734834c8f5 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -50,8 +50,7 @@ namespace Tgstation.Server.Host var basePath = IOManager.ResolvePath(); IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((context, builder) => { - builder.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true) - .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); //Allow both appsettings.json and appsettings.yml for backwards compat + builder.AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); //Allow both appsettings.json and appsettings.yml for backwards compat }); diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs index 927cb43982..0f2beb86d4 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using MySql.Data.MySqlClient; -using Newtonsoft.Json; using Npgsql; using System; using System.Collections.Generic; diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index b322b33c24..08581354e9 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -115,11 +115,16 @@ + - + + + + + PreserveNewest diff --git a/src/Tgstation.Server.Host/appsettings.json b/src/Tgstation.Server.Host/appsettings.json deleted file mode 100644 index efc04c7461..0000000000 --- a/src/Tgstation.Server.Host/appsettings.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "General": { - "MinimumPasswordLength": 15, - "GitHubAccessToken": null, - "SetupWizardMode": "AutoDetect", - "ByondTopicTimeout": 5000, - "RestartTimeout": 60000, - "ApiPort": 5000, - "UseBasicWatchdog": false, - "UserLimit": 100, - "UserGroupLimit": 25, - "InstanceLimit": 10, - "ValidInstancePaths": null, - "HostApiDocumentation": false - }, - "FileLogging": { - "Directory": null, - "Disable": false, - "LogLevel": "Debug", - "MicrosoftLogLevel": "Warning" - }, - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Debug", - "Microsoft": "Information" - } - }, - "Console": { - "LogLevel": { - "Default": "Trace", - "Microsoft": "Warning" - } - } - }, - "ControlPanel": { - "Enable": false, - "AllowAnyOrigin": false, - "AllowedOrigins": [] - }, - "Updates": { - "GitHubRepositoryId": 92952846, - "GitTagPrefix": "tgstation-server-v", - "UpdatePackageAssetName": "ServerUpdatePackage.zip" - }, - "Database": { - "DropDatabase": false, - "DatabaseType": "SqlServer", - "ResetAdminPassword": false, - "ServerVersion": null, - "ConnectionString": "Data Source=(local);Initial Catalog=TGS;Integrated Security=True" - }, - "Security": { - "TokenExpiryMinutes": 15, - "TokenClockSkewMinutes": 1, - "TokenSigningKeyByteAmount": 256, - "CustomTokenSigningKeyBase64": null, - "OAuth": { - "GitHub": null, - "Discord": null, - "TGForums": null, - "Keycloak": null - } - } -} diff --git a/src/Tgstation.Server.Host/appsettings.yml b/src/Tgstation.Server.Host/appsettings.yml new file mode 100644 index 0000000000..b53cd2832a --- /dev/null +++ b/src/Tgstation.Server.Host/appsettings.yml @@ -0,0 +1,52 @@ +General: + MinimumPasswordLength: 15 + GitHubAccessToken: + SetupWizardMode: AutoDetect + ByondTopicTimeout: 5000 + RestartTimeout: 60000 + ApiPort: 5000 + UseBasicWatchdog: false + UserLimit: 100 + UserGroupLimit: 25 + InstanceLimit: 10 + ValidInstancePaths: + HostApiDocumentation: false +FileLogging: + Directory: + Disable: false + LogLevel: Debug + MicrosoftLogLevel: Warning +Logging: + IncludeScopes: false + Debug: + LogLevel: + Default: Debug + Microsoft: Information + Console: + LogLevel: + Default: Trace + Microsoft: Warning +ControlPanel: + Enable: false + AllowAnyOrigin: false + AllowedOrigins: [] +Updates: + GitHubRepositoryId: 92952846 + GitTagPrefix: tgstation-server-v + UpdatePackageAssetName: ServerUpdatePackage.zip +Database: + DropDatabase: false + DatabaseType: SqlServer + ResetAdminPassword: false + ServerVersion: + ConnectionString: Data Source=(local);Initial Catalog=TGS;Integrated Security=True +Security: + TokenExpiryMinutes: 15 + TokenClockSkewMinutes: 1 + TokenSigningKeyByteAmount: 256 + CustomTokenSigningKeyBase64: + OAuth: + GitHub: + Discord: + TGForums: + Keycloak: From 0f78c17f21fd7bfd66b61b8e5ee73926f6dcd5db Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Sat, 16 Jan 2021 18:05:02 +0000 Subject: [PATCH 03/14] Last cybertweak --- src/Tgstation.Server.Host/ServerFactory.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index 734834c8f5..d310dc8ae2 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -50,7 +50,8 @@ namespace Tgstation.Server.Host var basePath = IOManager.ResolvePath(); IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((context, builder) => { - builder.AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); //Allow both appsettings.json and appsettings.yml for backwards compat + builder.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true) + .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); }); From 62d1d3806c11a7ec68ecf4ddbeaf144e5ce7f6b6 Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Mon, 18 Jan 2021 18:22:23 +0000 Subject: [PATCH 04/14] Lets give this a shot --- docs/Architecture.dox | 2 +- .../Database/MySqlDatabaseContext.cs | 3 ++- src/Tgstation.Server.Host/ServerFactory.cs | 11 ++++++++++- .../Tgstation.Server.Host.csproj | 5 ----- tests/Tgstation.Server.Tests/TestingServer.cs | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docs/Architecture.dox b/docs/Architecture.dox index e45b40ad70..6c5bdeea1d 100644 --- a/docs/Architecture.dox +++ b/docs/Architecture.dox @@ -23,7 +23,7 @@ This is a second process spawned by the Host Watchdog which facilitates the vast The server's entrypoint is in the @ref Tgstation.Server.Host.Program class. This class mainly determines if the Host watchdog is present and creates and runs the @ref Tgstation.Server.Host.Server class. That class then builds an ASP.NET Core web host using the @ref Tgstation.Server.Host.Core.Application class. -The @ref Tgstation.Server.Host.Core.Application class has two methods called by the framework. First the @ref Tgstation.Server.Host.Core.Application.ConfigureServices method sets up dependency injection of interfaces for Controllers, the @ref Tgstation.Server.Host.Database.DatabaseContext, and the component factories of the server. The framework handles constructing these things once the application starts. Configuration is loaded from the appropriate appSettings.yml into the @ref Tgstation.Server.Host.Configuration classes for injection as well. Then @ref Tgstation.Server.Host.Core.Application.Configure method is run which sets up the web request pipeline which currently has the following stack of handlers: +The @ref Tgstation.Server.Host.Core.Application class has two methods called by the framework. First the @ref Tgstation.Server.Host.Core.Application.ConfigureServices method sets up dependency injection of interfaces for Controllers, the @ref Tgstation.Server.Host.Database.DatabaseContext, and the component factories of the server. The framework handles constructing these things once the application starts. Configuration is loaded from the appropriate appsettings.yml into the @ref Tgstation.Server.Host.Configuration classes for injection as well. Then @ref Tgstation.Server.Host.Core.Application.Configure method is run which sets up the web request pipeline which currently has the following stack of handlers: - Catch any exceptions and respond with 500 and detailed HTML error page - Respond with 503 if the application is still starting or shutting down diff --git a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs index 46bd93309c..933b129983 100644 --- a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Pomelo.EntityFrameworkCore.MySql.Infrastructure; using System; using Tgstation.Server.Host.Configuration; @@ -42,6 +42,7 @@ namespace Tgstation.Server.Host.Database mySqlOptions.EnableRetryOnFailure(); if (!String.IsNullOrEmpty(databaseConfiguration.ServerVersion)) + Console.WriteLine("SQLVERSION: " + databaseConfiguration.DatabaseType); mySqlOptions.ServerVersion( Version.Parse(databaseConfiguration.ServerVersion), databaseConfiguration.DatabaseType == DatabaseType.MariaDB diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index d310dc8ae2..b94e29b140 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -52,7 +52,16 @@ namespace Tgstation.Server.Host .ConfigureAppConfiguration((context, builder) => { builder.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true) .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); - + // reorganize the builder so our yaml configs don't override the env/cmdline configs + // values obtained via debugger + var envConfig = builder.Sources[3]; + var cmdLineConfig = builder.Sources[4]; + var baseYmlConfig = builder.Sources[5]; + var environmentYmlConfig = builder.Sources[6]; + builder.Sources[3] = baseYmlConfig; + builder.Sources[4] = environmentYmlConfig; + builder.Sources[5] = envConfig; + builder.Sources[6] = cmdLineConfig; }); var setupWizardHostBuilder = CreateDefaultBuilder() diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 08581354e9..4c2a80535e 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -115,14 +115,9 @@ - - - - - PreserveNewest diff --git a/tests/Tgstation.Server.Tests/TestingServer.cs b/tests/Tgstation.Server.Tests/TestingServer.cs index f35f5c38ad..de938a16e0 100644 --- a/tests/Tgstation.Server.Tests/TestingServer.cs +++ b/tests/Tgstation.Server.Tests/TestingServer.cs @@ -110,7 +110,7 @@ namespace Tgstation.Server.Tests args.Add($"Security:OAuth=null"); // SPECIFICALLY DELETE THE DEV APPSETTINGS, WE DON'T WANT IT IN THE WAY - File.Delete("appsettings.Development.json"); + File.Delete("appsettings.Development.yml"); if (!String.IsNullOrEmpty(gitHubAccessToken)) args.Add(String.Format(CultureInfo.InvariantCulture, "General:GitHubAccessToken={0}", gitHubAccessToken)); From 0c67d64708ce021dc938d9bb4528c4ce3718358c Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Mon, 18 Jan 2021 18:30:15 +0000 Subject: [PATCH 05/14] I actually hate docker --- build/tgs.docker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tgs.docker.sh b/build/tgs.docker.sh index 490f318a42..d07e183573 100755 --- a/build/tgs.docker.sh +++ b/build/tgs.docker.sh @@ -5,8 +5,8 @@ SCRIPT_VERSION="1.2.0" echo "tgstation-server 4 container startup script v$SCRIPT_VERSION" echo "PWD: $PWD" -PROD_CONFIG=/config_data/appsettings.Production.json -HOST_CONFIG=/app/appsettings.Production.json +PROD_CONFIG=/config_data/appsettings.Production.yml +HOST_CONFIG=/app/appsettings.Production.yml if [ ! -f $PROD_CONFIG ]; then echo "$PROD_CONFIG not detected! Creating empty and running setup wizard..." From 6206755343868cc2fe694d7088d65939efa361eb Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Mon, 18 Jan 2021 18:44:51 +0000 Subject: [PATCH 06/14] More changes --- .gitignore | 1 + src/Tgstation.Server.Host/ServerFactory.cs | 12 +++++++----- .../Tgstation.Server.Host.csproj | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c09ef4b2ac..ce8eb6d9de 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ artifacts/ /tests/DMAPI/travistester.int /tests/DMAPI/travistester.dmb /src/Tgstation.Server.Host/appsettings.*.json +/src/Tgstation.Server.Host/appsettings.*.yml /src/Tgstation.Server.Host/wwwroot /src/Tgstation.Server.Host/ClientApp /tools/ReleaseNotes/release_notes.md diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index b94e29b140..9e75399f37 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -51,17 +51,19 @@ namespace Tgstation.Server.Host IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) .ConfigureAppConfiguration((context, builder) => { builder.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true) - .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); + .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); // reorganize the builder so our yaml configs don't override the env/cmdline configs // values obtained via debugger + var baseEnvironmentConfig = builder.Sources[2]; var envConfig = builder.Sources[3]; var cmdLineConfig = builder.Sources[4]; var baseYmlConfig = builder.Sources[5]; var environmentYmlConfig = builder.Sources[6]; - builder.Sources[3] = baseYmlConfig; - builder.Sources[4] = environmentYmlConfig; - builder.Sources[5] = envConfig; - builder.Sources[6] = cmdLineConfig; + builder.Sources[2] = baseYmlConfig; + builder.Sources[3] = environmentYmlConfig; + builder.Sources[4] = envConfig; + builder.Sources[5] = cmdLineConfig; + builder.Sources[6] = baseEnvironmentConfig; }); var setupWizardHostBuilder = CreateDefaultBuilder() diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 4c2a80535e..df28ae4642 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -118,6 +118,10 @@ + + + + PreserveNewest From 9f57b3d93712d3e3f56fd0a310e0f149bdeddbb0 Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Wed, 20 Jan 2021 18:38:59 +0000 Subject: [PATCH 07/14] Fix this atleast --- src/Tgstation.Server.Host/ServerFactory.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index 9e75399f37..a273d1507c 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -54,16 +54,16 @@ namespace Tgstation.Server.Host .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); // reorganize the builder so our yaml configs don't override the env/cmdline configs // values obtained via debugger - var baseEnvironmentConfig = builder.Sources[2]; + var environmentJsonConfig = builder.Sources[2]; var envConfig = builder.Sources[3]; var cmdLineConfig = builder.Sources[4]; var baseYmlConfig = builder.Sources[5]; var environmentYmlConfig = builder.Sources[6]; builder.Sources[2] = baseYmlConfig; - builder.Sources[3] = environmentYmlConfig; - builder.Sources[4] = envConfig; - builder.Sources[5] = cmdLineConfig; - builder.Sources[6] = baseEnvironmentConfig; + builder.Sources[3] = environmentJsonConfig; + builder.Sources[4] = environmentYmlConfig; + builder.Sources[5] = envConfig; + builder.Sources[6] = cmdLineConfig; }); var setupWizardHostBuilder = CreateDefaultBuilder() From 59750f632d9e87848fb65421f8a8a2e41d1fbf0c Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 12:26:42 -0500 Subject: [PATCH 08/14] Suppress a bad IDE warning --- .../Extensions/TestServiceCollectionExtensions.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs b/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs index 67004ad997..09c2bd502d 100644 --- a/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs +++ b/tests/Tgstation.Server.Host.Tests/Extensions/TestServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -16,7 +16,9 @@ namespace Tgstation.Server.Host.Extensions.Tests class BadConfig1 { +#pragma warning disable IDE0051 // Remove unused private members const string Section = "asdf"; +#pragma warning restore IDE0051 // Remove unused private members } class BadConfig2 From 7055a3879649382ba87d97639f48ca708c04fa24 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 12:42:56 -0500 Subject: [PATCH 09/14] Modernizes and adds YAML support to VersionConverter --- .../Extensions/Converters/VersionConverter.cs | 70 +++++++++++++++++-- 1 file changed, 65 insertions(+), 5 deletions(-) diff --git a/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs b/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs index 9d5ebeec77..3c18ce50e8 100644 --- a/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs +++ b/src/Tgstation.Server.Host/Extensions/Converters/VersionConverter.cs @@ -1,14 +1,35 @@ using Newtonsoft.Json; using System; using Tgstation.Server.Api; +using YamlDotNet.Core; +using YamlDotNet.Core.Events; +using YamlDotNet.Serialization; namespace Tgstation.Server.Host.Extensions.Converters { /// - /// for serializing s for BYOND. + /// and for serializing s for BYOND. /// - sealed class VersionConverter : JsonConverter + sealed class VersionConverter : JsonConverter, IYamlTypeConverter { + /// + /// Check if the supports (de)serializing a given . + /// + /// The to check. + /// If the method should if validation fails. + /// if is a , otherwise. + static bool CheckSupportsType(Type type, bool validate) + { + if (type == null) + throw new ArgumentNullException(nameof(type)); + + var supported = type == typeof(global::System.Version); + if (!supported && validate) + throw new NotSupportedException($"{nameof(VersionConverter)} does not convert {type}s!"); + + return supported; + } + /// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { @@ -16,7 +37,7 @@ namespace Tgstation.Server.Host.Extensions.Converters { writer.WriteNull(); } - else if (value is Version version) + else if (value is global::System.Version version) { writer.WriteValue(version.Semver().ToString()); } @@ -29,6 +50,11 @@ namespace Tgstation.Server.Host.Extensions.Converters /// public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { + if (reader == null) + throw new ArgumentNullException(nameof(reader)); + + CheckSupportsType(objectType, true); + if (reader.TokenType == JsonToken.Null) return null; @@ -36,7 +62,7 @@ namespace Tgstation.Server.Host.Extensions.Converters { try { - Version v = new Version((string)reader.Value); + var v = global::System.Version.Parse((string)reader.Value); return v.Semver(); } catch (Exception ex) @@ -50,6 +76,40 @@ namespace Tgstation.Server.Host.Extensions.Converters } /// - public override bool CanConvert(Type objectType) => objectType == typeof(Version); + public override bool CanConvert(Type objectType) => CheckSupportsType(objectType, false); + + /// + public bool Accepts(Type type) => CheckSupportsType(type, false); + + /// + public object ReadYaml(IParser parser, Type type) + { + if (parser == null) + throw new ArgumentNullException(nameof(parser)); + + CheckSupportsType(type, true); + + var scalar = parser.Consume(); + if (scalar == null) + return null; + + return global::System.Version.Parse(scalar.Value); + } + + /// + public void WriteYaml(IEmitter emitter, object value, Type type) + { + if (emitter == null) + throw new ArgumentNullException(nameof(emitter)); + + CheckSupportsType(type, true); + + var version = (global::System.Version)value; + emitter.Emit( + new Scalar( + version + ?.Semver() + .ToString())); + } } } From caec6e95471ef4c32433fb5963ee9fd4cdeb077b Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 12:43:09 -0500 Subject: [PATCH 10/14] YAML unit tests for VersionConverter --- .../Converters/TestVersionConverter.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/Tgstation.Server.Host.Tests/Extensions/Converters/TestVersionConverter.cs diff --git a/tests/Tgstation.Server.Host.Tests/Extensions/Converters/TestVersionConverter.cs b/tests/Tgstation.Server.Host.Tests/Extensions/Converters/TestVersionConverter.cs new file mode 100644 index 0000000000..a650c0e97f --- /dev/null +++ b/tests/Tgstation.Server.Host.Tests/Extensions/Converters/TestVersionConverter.cs @@ -0,0 +1,52 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using Tgstation.Server.Api; +using YamlDotNet.Serialization; + +namespace Tgstation.Server.Host.Extensions.Converters.Tests +{ + [TestClass] + public sealed class TestVersionConverter + { + class TestObject + { + public Version Version { get; set; } + } + + readonly Version testVersion; + readonly string testYaml; + + public TestVersionConverter() + { + testVersion = new Version(1, 2, 3); + testYaml = $@"{nameof(TestObject.Version)}: {testVersion.Semver()}"; + } + + [TestMethod] + public void TestYamlSerialization() + { + var testObj = new TestObject + { + Version = testVersion + }; + + var serializedString = new SerializerBuilder() + .WithTypeConverter(new VersionConverter()) + .Build() + .Serialize(testObj); + + Assert.AreEqual(testYaml, serializedString.Trim()); + } + + [TestMethod] + public void TestYamlDeserialization() + { + var deserialized = new DeserializerBuilder() + .WithTypeConverter(new VersionConverter()) + .Build() + .Deserialize(testYaml); + + Assert.AreEqual(testVersion, deserialized.Version); + } + } +} From 91bf7e7f1c693ff35c7199dd9f4c618d226d1183 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 12:44:27 -0500 Subject: [PATCH 11/14] Properly serializes General:ConfigVersion in setup --- src/Tgstation.Server.Host/Setup/SetupWizard.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs index 0f2beb86d4..af806cab3f 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs @@ -19,6 +19,7 @@ using System.Threading.Tasks; using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.Core; using Tgstation.Server.Host.Database; +using Tgstation.Server.Host.Extensions.Converters; using Tgstation.Server.Host.IO; using Tgstation.Server.Host.System; using YamlDotNet.Serialization; @@ -841,7 +842,9 @@ namespace Tgstation.Server.Host.Setup { SwarmConfiguration.Section, swarmConfiguration }, }; - var serializer = new SerializerBuilder().Build(); + var serializer = new SerializerBuilder() + .WithTypeConverter(new VersionConverter()) + .Build(); var serializedYaml = serializer.Serialize(map); From 22ea6d24345d212c25b108b96ea3ef53739e3a77 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 14:59:30 -0500 Subject: [PATCH 12/14] Revert the basepath change Pretty certain this is needed to make production configs work --- src/Tgstation.Server.Host/ServerFactory.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/ServerFactory.cs b/src/Tgstation.Server.Host/ServerFactory.cs index a273d1507c..e739d5c75f 100644 --- a/src/Tgstation.Server.Host/ServerFactory.cs +++ b/src/Tgstation.Server.Host/ServerFactory.cs @@ -49,7 +49,10 @@ namespace Tgstation.Server.Host var basePath = IOManager.ResolvePath(); IHostBuilder CreateDefaultBuilder() => Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) - .ConfigureAppConfiguration((context, builder) => { + .ConfigureAppConfiguration((context, builder) => + { + builder.SetBasePath(basePath); + builder.AddYamlFile("appsettings.yml", optional: true, reloadOnChange: true) .AddYamlFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.yml", optional: true, reloadOnChange: true); // reorganize the builder so our yaml configs don't override the env/cmdline configs From 2e92b8dea1e09bfb5fd8b4893a28e485c6e75055 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 16:21:49 -0500 Subject: [PATCH 13/14] More missed references to appsettings.json --- .dockerignore | 1 + .github/CONTRIBUTING.md | 2 +- src/Tgstation.Server.Host/Setup/SetupWizardMode.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index de4eb887ed..4a54e2617a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -26,6 +26,7 @@ src/DMAPI src/Tgstation.Server.Host/ClientApp src/Tgstation.Server.Host/wwwroot src/Tgstation.Server.Host/appsettings.Development.json +src/Tgstation.Server.Host/appsettings.Development.yml src/Tgstation.Server.Host/tgs.bat src/Tgstation.Server.Host/tgs.sh src/Tgstation.Server.Client diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 96eb6e3108..a096c248c4 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -197,7 +197,7 @@ OAuth providers are hardcoded but it is fairly easy to add new ones. The flow do 1. Create an implementation of [IOAuthValidator](../src/Tgstation.Server.Host/Security/OAuth/IOAuthValidator.cs). - Most providers can simply override the [GenericOAuthValidator](../src/Tgstation.Server.Host/Security/OAuth/GenericOAuthValidator.cs). 1. Construct the implementation in the [OAuthProviders](../src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs) class. -1. Add a null entry to the default [appsettings.json](../src/Tgstation.Server.Host/appsettings.json). +1. Add a null entry to the default [appsettings.yml](../src/Tgstation.Server.Host/appsettings.yml). 1. Update the main [README.md](../README.md) to indicate the new provider. 1. Update the [API documentation](../docs/API.dox) to indicate the new provider. diff --git a/src/Tgstation.Server.Host/Setup/SetupWizardMode.cs b/src/Tgstation.Server.Host/Setup/SetupWizardMode.cs index 8d0798b88f..2de9926e82 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizardMode.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizardMode.cs @@ -6,7 +6,7 @@ namespace Tgstation.Server.Host.Setup public enum SetupWizardMode { /// - /// Run the wizard if the appsettings.{Environment}.json is not present or empty. + /// Run the wizard if the appsettings.{Environment}.yml is not present or empty. /// Autodetect, From 9aa4bd0c8ca3d2d23fcf8eef1d972c593c8b06aa Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 21 Jan 2021 16:22:05 -0500 Subject: [PATCH 14/14] Remove Console debug line that broke logic --- src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs index 933b129983..9c4f6dab09 100644 --- a/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/MySqlDatabaseContext.cs @@ -42,7 +42,6 @@ namespace Tgstation.Server.Host.Database mySqlOptions.EnableRetryOnFailure(); if (!String.IsNullOrEmpty(databaseConfiguration.ServerVersion)) - Console.WriteLine("SQLVERSION: " + databaseConfiguration.DatabaseType); mySqlOptions.ServerVersion( Version.Parse(databaseConfiguration.ServerVersion), databaseConfiguration.DatabaseType == DatabaseType.MariaDB