public ShellSettingsManager(IConfiguration applicationConfiguration, IShellsConfigurationSources tenantsConfigSources, IShellConfigurationSources tenantConfigSources, IShellsSettingsSources settingsSources) { this._semaphore = new SemaphoreSlim(1); base(); this._applicationConfiguration = applicationConfiguration; this._tenantsConfigSources = tenantsConfigSources; this._tenantConfigSources = tenantConfigSources; this._settingsSources = settingsSources; return; }
public ShellSettingsManager( IConfiguration applicationConfiguration, IShellsConfigurationSources tenantsConfigSources, IShellConfigurationSources tenantConfigSources, IShellsSettingsSources settingsSources) { _applicationConfiguration = applicationConfiguration; _tenantsConfigSources = tenantsConfigSources; _tenantConfigSources = tenantConfigSources; _settingsSources = settingsSources; }
public ShellSettingsManager( IConfiguration applicationConfiguration, IShellsConfigurationSources configurationSources, IShellConfigurationSources tenantConfigSources, IShellsSettingsSources settingsSources, IOptions <ShellOptions> options) { // TODO: Can be removed when going to RC. var appDataPath = options.Value.ShellsApplicationDataPath; _tenantsContainerPath = Path.Combine(appDataPath, options.Value.ShellsContainerName); _tenantConfigSources = tenantConfigSources; _settingsSources = settingsSources; var lastProviders = (applicationConfiguration as IConfigurationRoot)?.Providers .Where(p => p is EnvironmentVariablesConfigurationProvider || p is CommandLineConfigurationProvider) .ToArray(); var configurationBuilder = new ConfigurationBuilder() .AddConfiguration(applicationConfiguration) .AddSources(configurationSources); if (lastProviders.Count() > 0) { configurationBuilder.AddConfiguration(new ConfigurationRoot(lastProviders)); } _configuration = configurationBuilder.Build().GetSection("OrchardCore"); _configuredTenants = _configuration.GetChildren() .Where(section => section["State"] != null) .Select(section => section.Key) .Distinct() .ToArray(); _configBuilderFactory = (tenant) => { var builder = new ConfigurationBuilder().AddConfiguration(_configuration); if (_configuredTenants.Contains(tenant)) { builder.AddConfiguration(_configuration.GetSection(tenant)); } return(builder.AddSources(tenant, _tenantConfigSources)); }; }
public ShellSettingsManager( IConfiguration applicationConfiguration, IShellsConfigurationSources configurationSources, IShellConfigurationSources tenantConfigSources, IShellsSettingsSources settingsSources, IOptions <ShellOptions> options) { _tenantConfigSources = tenantConfigSources; _settingsSources = settingsSources; var lastProviders = (applicationConfiguration as IConfigurationRoot)?.Providers .Where(p => p is EnvironmentVariablesConfigurationProvider || p is CommandLineConfigurationProvider) .ToArray(); var configurationBuilder = new ConfigurationBuilder() .AddConfiguration(applicationConfiguration) .AddSources(configurationSources); if (lastProviders.Count() > 0) { configurationBuilder.AddConfiguration(new ConfigurationRoot(lastProviders)); } _configuration = configurationBuilder.Build().GetSection("OrchardCore"); _configuredTenants = _configuration.GetChildren() .Where(section => Enum.TryParse <TenantState>(section["State"], ignoreCase: true, out var result)) .Select(section => section.Key) .Distinct() .ToArray(); _configBuilderFactory = (tenant) => { var builder = new ConfigurationBuilder().AddConfiguration(_configuration); builder.AddConfiguration(_configuration.GetSection(tenant)); return(builder.AddSources(tenant, _tenantConfigSources)); }; }
public static IConfigurationBuilder AddSources(this IConfigurationBuilder builder, string tenant, IShellConfigurationSources sources) { sources.AddSources(tenant, builder); return(builder); }
public static async Task <IConfigurationBuilder> AddSourcesAsync(this IConfigurationBuilder builder, string tenant, IShellConfigurationSources sources) { await sources.AddSourcesAsync(tenant, builder); return(builder); }