示例#1
0
        // IProxyConfigManager

        /// <inheritdoc/>
        public async Task <EndpointDataSource> InitialLoadAsync()
        {
            // Trigger the first load immediately and throw if it fails.
            // We intend this to crash the app so we don't try listening for further changes.
            try
            {
                var config = _provider.GetConfig();
                await ApplyConfigAsync(config);

                if (config.ChangeToken.ActiveChangeCallbacks)
                {
                    _changeSubscription = config.ChangeToken.RegisterChangeCallback(ReloadConfig, this);
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Unable to load or apply the proxy configuration.", ex);
            }

            return(this);
        }
        public ActionResult DumpRoutes()
        {
            var proxyConfig = _proxyConfigProvider.GetConfig();

            return(Ok(proxyConfig.Routes));
        }