Example #1
0
        public void Start()
        {
#if DEBUG
            string environmentName = "awesome!";
#else
            string environmentName = EC2Environment.GetEnvironmentName();
#endif
            MachineConfig machineConfig = new MachineConfig(environmentName);
            this.restartService = new RestartHubClient(machineConfig);

            string configFile = ConfigurationManager.AppSettings["File"];
            ConfigOverrideManager configOverrideManager = new ConfigOverrideManager(configFile);

            this.configUpdater   = new ConfigUpdater(machineConfig, configOverrideManager);
            this.configHubClient = new ConfigHubClient(machineConfig, this.configUpdater);
        }
Example #2
0
        public ConfigUpdater(MachineConfig machineConfig, ConfigOverrideManager configManager)
        {
            if (configManager == null)
            {
                throw new ArgumentNullException(nameof(configManager));
            }

            this.configManager = configManager;

            this.file = new RemoteFile(machineConfig);
            string dic = Path.GetDirectoryName(this.configManager.ConfigPath);

            this.fileWatcher          = new FileSystemWatcher(dic);
            this.fileWatcher.Changed += this.FileChanged;
            // sometimes we are deployed before the web.config is wrote
            this.fileWatcher.Created            += this.FileChanged;
            this.fileWatcher.EnableRaisingEvents = true;

            TimeSpan reloadTime = TimeSpan.FromMinutes(1);

            this.timer = new Timer(ConfigUpdater.TimerCallback, this, TimeSpan.Zero, reloadTime);
        }