// Create a discovery client to be used (hopefully only) during startup
        internal void SetupDiscoveryClient()
        {
            var services = new ServiceCollection();

            if (_logFactory != null)
            {
                services.AddSingleton(_logFactory);
                services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger <>), typeof(Logger <>)));
            }

            // force settings to make sure we don't register the app here
            var cfgBuilder = new ConfigurationBuilder()
                             .AddConfiguration(_configuration)
                             .AddInMemoryCollection(
                new Dictionary <string, string>
            {
                { "Eureka:Client:ShouldRegisterWithEureka", "false" },
                { "Consul:Discovery:Register", "false" }
            });

            services.AddSingleton <IConfiguration>(cfgBuilder.Build());
            services.AddDiscoveryClient(_configuration);

            using var startupServiceProvider = services.BuildServiceProvider();
            _discoveryClient = startupServiceProvider.GetRequiredService <IDiscoveryClient>();
            _logger.LogDebug("Found Discovery Client of type {DiscoveryClientType}", _discoveryClient.GetType());
        }