public async Task <IActionResult> Get( [FromServices] HealthUrls healthUrls, [FromServices] ILifetimeScope scope, CancellationToken cancellationToken = default) { var versions = new ConcurrentDictionary <string, string>(); versions.TryAdd("publicApi", FormatVersion(Assembly.GetEntryAssembly().GetName().Version.ToString(4))); await Task.WhenAll(healthUrls.Select(x => GetDownstreamVersionAsync(x.Key, scope, versions, cancellationToken))); return(Ok(versions.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value))); }
protected override void Load(ContainerBuilder builder) { var healthUrls = new HealthUrls(); foreach (var registry in _apiConfiguration) { RegisterRestClient(registry.Key, registry.Value.ApiUrl, _downstreamUser, _downstreamPass, _serviceName, builder); RegisterHealthClient(registry.Key, registry.Value.HealthUrl, _downstreamUser, _downstreamPass, _serviceName, builder); RegisterApiCacheToggle(registry.Key, registry.Value.UseCache, builder); healthUrls.Add(registry.Key, registry.Value.HealthUrl); } builder.RegisterInstance(healthUrls); }
public async Task <IActionResult> Get( [FromServices] IConfiguration configuration, [FromServices] HealthUrls healthUrls, [FromServices] MarketingVersion version, [FromServices] ILifetimeScope scope, CancellationToken cancellationToken = default) { var components = new ConcurrentDictionary <string, string>(); components.TryAdd("publicApi", FormatVersion(Assembly.GetEntryAssembly().GetName().Version.ToString(4))); components.TryAdd("publicSite", configuration["SiteVersion"]); await Task.WhenAll(healthUrls.Select(url => GetDownstreamVersionAsync(url.Key, scope, components, cancellationToken))); return(Ok(new ApiVersionResponse(version, components))); }