U4-9018 - provide a way to disable server master election
This commit is contained in:
37
src/Umbraco.Core/Sync/SingleServerRegistrar.cs
Normal file
37
src/Umbraco.Core/Sync/SingleServerRegistrar.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.Sync
|
||||
{
|
||||
public class SingleServerRegistrar : IServerRegistrar2
|
||||
{
|
||||
private readonly string _umbracoApplicationUrl;
|
||||
|
||||
public IEnumerable<IServerAddress> Registrations { get; private set; }
|
||||
|
||||
public SingleServerRegistrar()
|
||||
{
|
||||
_umbracoApplicationUrl = ApplicationContext.Current.UmbracoApplicationUrl;
|
||||
Registrations = new[] { new ServerAddressImpl(_umbracoApplicationUrl) };
|
||||
}
|
||||
|
||||
public ServerRole GetCurrentServerRole()
|
||||
{
|
||||
return ServerRole.Single;
|
||||
}
|
||||
|
||||
public string GetCurrentServerUmbracoApplicationUrl()
|
||||
{
|
||||
return _umbracoApplicationUrl;
|
||||
}
|
||||
|
||||
private class ServerAddressImpl : IServerAddress
|
||||
{
|
||||
public ServerAddressImpl(string serverAddress)
|
||||
{
|
||||
ServerAddress = serverAddress;
|
||||
}
|
||||
|
||||
public string ServerAddress { get; private set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1330,6 +1330,7 @@
|
||||
<Compile Include="Sync\ApplicationUrlHelper.cs" />
|
||||
<Compile Include="Sync\RefreshMethodType.cs" />
|
||||
<Compile Include="Sync\ServerMessengerBase.cs" />
|
||||
<Compile Include="Sync\SingleServerRegistrar.cs" />
|
||||
<Compile Include="ThreadExtensions.cs" />
|
||||
<Compile Include="TopologicalSorter.cs" />
|
||||
<Compile Include="Strings\DefaultUrlSegmentProvider.cs" />
|
||||
|
||||
Reference in New Issue
Block a user