private ServiceDiscoveryConfig ApplyDefaults(ServiceDiscoveryConfig item, PortAllocationConfig portAllocationConfig) { item.ReloadInterval = item.ReloadInterval ?? DefaultItem.ReloadInterval; item.DelayMultiplier = item.DelayMultiplier ?? DefaultItem.DelayMultiplier; item.FirstAttemptDelaySeconds = item.FirstAttemptDelaySeconds ?? DefaultItem.FirstAttemptDelaySeconds; item.MaxAttemptDelaySeconds = item.MaxAttemptDelaySeconds ?? DefaultItem.MaxAttemptDelaySeconds; item.RequestTimeout = item.RequestTimeout ?? DefaultItem.RequestTimeout; item.Scope = item.Scope ?? DefaultItem.Scope; item.Source = item.Source ?? DefaultItem.Source; if (portAllocationConfig.IsSlotMode && item.DefaultSlotNumber.HasValue) { item.DefaultPort = portAllocationConfig.GetPort(item.DefaultSlotNumber, PortOffsets.Http); } return(item); }
public ServiceDiscoveryCollection(IDictionary <string, ServiceDiscoveryConfig> source, ServiceDiscoveryConfig defaultItem, PortAllocationConfig portAllocationConfig) { DefaultItem = defaultItem; Source = source.ToDictionary(kvp => kvp.Key, kvp => ApplyDefaults(kvp.Value, portAllocationConfig)).ToImmutableDictionary(StringComparer.OrdinalIgnoreCase); }
public ServiceDiscoveryCollection(IDictionary <string, ServiceDiscoveryConfig> source, ServiceDiscoveryConfig defaultItem, PortAllocationConfig portAllocationConfig) : base(source, defaultItem) { _portAllocationConfig = portAllocationConfig; }