예제 #1
0
 public DnsUpdaterTestPad(IConfigHandler configHandler, 
     IIpChecker ipchecker,
     IAmazonRoute53 amazonClient)
 {
     _configHandler = configHandler;
     _ipChecker = ipchecker;
     _amazonClient = amazonClient;
 }
예제 #2
0
        private void InitConfig()
        {
            AddLog("Loading configuration values...");

            // _configHandler = new AppConfigHandler();
            _configHandler = new JsonConfigHandler();
            var config = _configHandler.GetConfig();
            _ipChecker = new AwsIpChecker();
            IAmazonRoute53 _amazonClient = new AmazonRoute53Client(config.Route53AccessKey, config.Route53SecretKey, RegionEndpoint.EUWest1);
            _dnsUpdater = new DnsUpdater(_configHandler, _ipChecker, _amazonClient);

            AddLog($"Found {config.DomainList.Count} domain(s)");
            foreach (HostedDomainInfo domainInfo in config.DomainList)
            {
                AddLog($"{domainInfo.DomainName}");
            }

            if (_timer != null)
            {
                // Stop to avoid multiple timer_Tick invocations
                _timer.Stop();
            }

            int interval = config.UpdateInterval;
            _timer = new System.Windows.Threading.DispatcherTimer();
            _timer.Tick += timer_Tick;
            _timer.Interval = new TimeSpan(0, interval, 0);
            _timer.Start();

            AddLog($"Time set to update domains every {interval} minutes");

            SetAutoStart();
        }