rename main server name
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
using Dalamud.Plugin;
|
||||
using MareSynchronos.MareConfiguration.Configurations;
|
||||
using MareSynchronos.WebAPI;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MareSynchronos.MareConfiguration;
|
||||
|
||||
public class ConfigurationMigrator(ILogger<ConfigurationMigrator> logger, TransientConfigService transientConfigService) : IHostedService
|
||||
public class ConfigurationMigrator(ILogger<ConfigurationMigrator> logger, TransientConfigService transientConfigService,
|
||||
ServerConfigService serverConfigService) : IHostedService
|
||||
{
|
||||
private readonly ILogger<ConfigurationMigrator> _logger = logger;
|
||||
|
||||
public void Migrate()
|
||||
{
|
||||
if (transientConfigService.Current.Version == 0)
|
||||
{
|
||||
_logger.LogInformation("Migrating Transient Config V0 => V1");
|
||||
transientConfigService.Current.TransientConfigs.Clear();
|
||||
transientConfigService.Current.Version = 1;
|
||||
transientConfigService.Save();
|
||||
}
|
||||
|
||||
if (serverConfigService.Current.Version == 1)
|
||||
{
|
||||
_logger.LogInformation("Migrating Server Config V1 => V2");
|
||||
var centralServer = serverConfigService.Current.ServerStorage.Find(f => f.ServerName.Equals("Lunae Crescere Incipientis (Central Server EU)", StringComparison.Ordinal));
|
||||
if (centralServer != null)
|
||||
{
|
||||
centralServer.ServerName = ApiController.MainServer;
|
||||
}
|
||||
serverConfigService.Current.Version = 2;
|
||||
serverConfigService.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -16,5 +16,5 @@ public class ServerConfig : IMareConfiguration
|
||||
public bool SendCensusData { get; set; } = false;
|
||||
public bool ShownCensusPopup { get; set; } = false;
|
||||
|
||||
public int Version { get; set; } = 1;
|
||||
public int Version { get; set; } = 2;
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace MareSynchronos.WebAPI;
|
||||
#pragma warning disable MA0040
|
||||
public sealed partial class ApiController : DisposableMediatorSubscriberBase, IMareHubClient
|
||||
{
|
||||
public const string MainServer = "Lunae Crescere Incipientis (Central Server EU)";
|
||||
public const string MainServer = "Lunae Crescere Incipientis (Official Central Server)";
|
||||
public const string MainServiceUri = "wss://maresynchronos.com";
|
||||
|
||||
private readonly DalamudUtilService _dalamudUtil;
|
||||
|
||||
Reference in New Issue
Block a user