Ejemplo n.º 1
0
        public FilePeersProvider(IOptions <FilePeers> options, IBaseUrlFinder finder, IOcelotConfigurationProvider provider, IIdentityServerConfiguration identityServerConfig)
        {
            _identityServerConfig = identityServerConfig;
            _provider             = provider;
            _finder  = finder;
            _options = options;
            _peers   = new List <IPeer>();
            //todo - sort out async nonsense..
            var config = _provider.Get().GetAwaiter().GetResult();

            foreach (var item in _options.Value.Peers)
            {
                var httpClient = new HttpClient();
                //todo what if this errors?
                var httpPeer = new HttpPeer(item.HostAndPort, httpClient, _finder, config.Data, _identityServerConfig);
                _peers.Add(httpPeer);
            }
        }
Ejemplo n.º 2
0
        public FilePeersProvider(IOptions <FilePeers> options, IBaseUrlFinder finder, IInternalConfigurationRepository repo, IIdentityServerConfiguration identityServerConfig)
        {
            _identityServerConfig = identityServerConfig;
            _repo    = repo;
            _finder  = finder;
            _options = options;
            _peers   = new List <IPeer>();

            var config = _repo.Get();

            foreach (var item in _options.Value.Peers)
            {
                var httpClient = new HttpClient();

                //todo what if this errors?
                var httpPeer = new HttpPeer(item.HostAndPort, httpClient, _finder, config.Data, _identityServerConfig);
                _peers.Add(httpPeer);
            }
        }