public static void SetUp(Func <ServiceDiscoveryConfiguration> configurationFunction) { var configuration = configurationFunction.Invoke(); var consulClient = new ConsulClient(consulConfig => { consulConfig.Address = new Uri(configuration.Address); }); ServiceDiscoveryHandler.Initialize(consulClient); }
private static async Task <string> ResolverServiceName( string serviceToDiscovery, string baseUrl) { var serviceInformation = await ServiceDiscoveryHandler .RecoverServiceInformation(serviceToDiscovery); if (serviceInformation == null) { throw new ServiceDiscoveryException( $"Given service name '{serviceToDiscovery}' was not found on Consul catalog"); } return(Regex.Replace(baseUrl, @"\{.*?}", $"{serviceInformation.Address}:{serviceInformation.Port}")); }