public static List <IServerRecord> GetServerRecords( string functionAppDirectory, IConfiguration configuration, ILogger logger) { if (_serversRecords == null) { var configSection = configuration.GetSection("tenantOptions"); TenantOptions tenantOptions = new TenantOptions(); configSection.Bind(tenantOptions); var serverRecords = new List <IServerRecord>(); foreach (var tenant in tenantOptions.Tenants) { serverRecords.Add( new ServerRecord <TStartup>( tenant.Name, functionAppDirectory, tenant.SettingsPath, configuration, logger) { BaseUrl = tenant.BaseUrl, PathStringBaseUrl = new PathString(tenant.BaseUrl) }); } _serversRecords = serverRecords; } return(_serversRecords); }
public ActionResult <TenantOptions> Get(int tenantId) { TenantOptions value = null; var section = configuration.GetSection($"TenantConfigs:Tree:Tenant{tenantId}"); if (section != null) { value = section.Get <TenantOptions>(); if (value == null) { logger.LogInformation("Trying to deserialize from string"); try { value = JsonConvert.DeserializeObject <TenantOptions>(section.Value); } catch (Exception deserilizationException) { logger?.LogWarning(deserilizationException, "Can't deserialize tenant config"); } } } if (value == null) { return(NotFound()); } else { return(value); } }
public TenantStore(ITenantStoreProvider tenantStoreProvider, IOptions <TenantOptions> options, ICacheService cacheService) { _tenantStoreProvider = tenantStoreProvider.NotNull(); _options = options.Value.NotNull(); _cacheService = cacheService.NotNull(); }