public static ServiceConfig GetServiceConfig(this IConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } var serviceConfig = new ServiceConfig { ServiceDiscoveryAddress = configuration.GetValue<Uri>("ServiceConfig:serviceDiscoveryAddress"), ServiceAddress = configuration.GetValue<Uri>("ServiceConfig:serviceAddress"), ServiceName = configuration.GetValue<string>("ServiceConfig:serviceName"), ServiceId = configuration.GetValue<string>("ServiceConfig:serviceId") }; return serviceConfig; }
public ServiceDiscoveryHostedService(IConsulClient client, ServiceConfig config) { _client = client; _config = config; }