Configuration for Broker.
This commit is contained in:
@ -0,0 +1,51 @@
|
||||
using MessengerApi.Configuration.Model.Persistence.Base;
|
||||
using MessengerApi.Configuration.Parsers;
|
||||
using MessengerApi.Configuration.Sources.Environment;
|
||||
using MessengerBroker.Configuration.Model.Servers;
|
||||
using MessengerBroker.Configuration.Parsers;
|
||||
using MessengerBroker.Configuration.Sources.Environment;
|
||||
|
||||
namespace MessengerBroker.Configuration.Model
|
||||
{
|
||||
public class BrokerConfiguration
|
||||
{
|
||||
public PersistenceConfiguration ApiPersistenceConfiguration { get; set; }
|
||||
|
||||
public PersistenceConfiguration BrokerPersistenceConfiguration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of proxies that are trusted to provide forwarding headers.
|
||||
/// </summary>
|
||||
public string[] Proxies { get; set; }
|
||||
|
||||
public Guid BrokerId { get; set; }
|
||||
|
||||
public MasterServer[] MasterServers { get; set; }
|
||||
|
||||
public SlaveServer[] SlaveServers { get; set; }
|
||||
|
||||
public BrokerConfiguration(
|
||||
PersistenceConfiguration apiPersistenceConfiguration,
|
||||
PersistenceConfiguration broPersistenceConfiguration,
|
||||
Guid brokerId,
|
||||
MasterServer[] masters,
|
||||
SlaveServer[] slaves)
|
||||
{
|
||||
this.ApiPersistenceConfiguration = apiPersistenceConfiguration;
|
||||
this.BrokerPersistenceConfiguration = broPersistenceConfiguration;
|
||||
this.BrokerId = brokerId;
|
||||
this.MasterServers = masters;
|
||||
this.SlaveServers = slaves;
|
||||
this.Proxies = [];
|
||||
}
|
||||
|
||||
public BrokerConfiguration(IEnvironmentConfigurationSource config):this(
|
||||
ApiEnvironmentPersistenceConfigurationParser.Parse(config),
|
||||
EnvironmentPersistenceConfigurationParser.Parse(config),
|
||||
config.GetValue<Guid>(Constants.EnvironmentVariables.BROKER_ID),
|
||||
MasterServerParser.Parse(config.GetValue<string>(Constants.EnvironmentVariables.MASTER_SERVERS)),
|
||||
SlaveServerParser.Parse(config.GetValue<string>(Constants.EnvironmentVariables.SLAVE_SERVERS)))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user