Пример #1
0
 public ConsulRefresher(Pandora pandora, ConsulClient consul, TimeSpan refreshInterval)
 {
     this.pandora         = pandora;
     this.consul          = consul;
     this.refreshInterval = refreshInterval;
     getTask = Task.Factory.StartNew(RefreshAsync);
 }
        public override IConfigurationProvider Build(IConfigurationBuilder builder)
        {
            IPandoraContext          context    = new ApplicationContext();
            IConfigurationRepository repository = new ConsulForPandora(new Uri(consulHost));

            Pandora             = new Pandora(context, repository);
            ChangeTokenConsumer = (provider) => Task.Factory.StartNew(() => provider.Load(reload: true));

            return(new PandoraConfigurationProvider(this));
        }
        public IConfigurationProvider Build(IConfigurationBuilder builder)
        {
            string              applicationName = Environment.GetEnvironmentVariable("APPLICATION_NAME");
            IPandoraContext     context         = new ClusterContext(applicationName);
            IPandoraGitSettings gitSettings     = new GitSettingsFromEnvironmentVariables();
            IPandoraFactory     pandoraFactory  = new PandoraGitFactory(context, gitSettings);

            Elders.Pandora.Pandora pandora = new Elders.Pandora.Pandora(pandoraFactory);

            return(new PandoraConfigurationProvider(pandora));
        }
Пример #4
0
        public override IConfigurationProvider Build(IConfigurationBuilder builder)
        {
            IPandoraContext context = new ApplicationContext();

            ConsulForPandora repository = new ConsulForPandora(consulHost);

            Pandora             = new Pandora(context, repository);
            ReloadWatcher       = new ConsulRefresher(Pandora, new ConsulClient(consulHost), ReloadDelay);
            ChangeTokenConsumer = (provider) => Task.Factory.StartNew(() => provider.Load());

            return(new PandoraConfigurationProvider(this));
        }