diff --git a/Minecraft-Realms-Emulator/Program.cs b/Minecraft-Realms-Emulator/Program.cs index 0eff4e9..97e0eb7 100644 --- a/Minecraft-Realms-Emulator/Program.cs +++ b/Minecraft-Realms-Emulator/Program.cs @@ -50,8 +50,7 @@ var db = scope.ServiceProvider.GetRequiredService(); app.MapControllers(); -var config = new ConfigHelper(db); -var mode = config.GetSetting(nameof(SettingsEnum.WorkMode)); +var mode = Environment.GetEnvironmentVariable("WORKMODE"); if (mode == null) { @@ -59,13 +58,13 @@ if (mode == null) Environment.Exit(1); } -if (!Enum.IsDefined(typeof(WorkModeEnum), mode.Value)) +if (!Enum.IsDefined(typeof(WorkModeEnum), mode)) { Console.WriteLine("Invalid server work mode, exiting"); Environment.Exit(1); } -if (mode.Value == nameof(WorkModeEnum.REALMS)) +if (mode == nameof(WorkModeEnum.REALMS)) { var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames(); @@ -117,7 +116,7 @@ if (mode.Value == nameof(WorkModeEnum.REALMS)) } } -var rewriteOptions = new RewriteOptions().AddRewrite(@"^(?!api)(.*)$", $"modes/{mode.Value}/$1", true); +var rewriteOptions = new RewriteOptions().AddRewrite(@"^(?!api)(.*)$", $"modes/{mode}/$1", true); app.UseRewriter(rewriteOptions); app.UseMiddleware(); @@ -127,5 +126,5 @@ app.UseMiddleware(); app.UseMiddleware(); app.UseMiddleware(); -Console.WriteLine($"Running in {mode.Value} mode"); +Console.WriteLine($"Running in {mode} mode"); app.Run(); diff --git a/Minecraft-Realms-Emulator/Shared/Enums/SettingsEnum.cs b/Minecraft-Realms-Emulator/Shared/Enums/SettingsEnum.cs index e89121b..86e23ec 100644 --- a/Minecraft-Realms-Emulator/Shared/Enums/SettingsEnum.cs +++ b/Minecraft-Realms-Emulator/Shared/Enums/SettingsEnum.cs @@ -5,7 +5,6 @@ NewsLink, DefaultServerAddress, TrialMode, - WorkMode, OnlineMode, AutomaticRealmsCreation } diff --git a/Minecraft-Realms-Emulator/Shared/Helpers/Config/Settings.cs b/Minecraft-Realms-Emulator/Shared/Helpers/Config/Settings.cs index e98d939..44c5794 100644 --- a/Minecraft-Realms-Emulator/Shared/Helpers/Config/Settings.cs +++ b/Minecraft-Realms-Emulator/Shared/Helpers/Config/Settings.cs @@ -1,13 +1,10 @@ -using Minecraft_Realms_Emulator.Shared.Enums; - -namespace Minecraft_Realms_Emulator.Shared.Helpers.Config +namespace Minecraft_Realms_Emulator.Shared.Helpers.Config { public class Settings { public string DefaultServerAddress { get; set; } = "127.0.0.1"; public string NewsLink { get; set; } = "https://github.com/CyberL1/Minecraft-Realms-Emulator"; public bool TrialMode { get; set; } = true; - public string WorkMode { get; set; } = nameof(WorkModeEnum.EXTERNAL); public bool OnlineMode { get; set; } = false; public bool AutomaticRealmsCreation { get; set; } = true; }