private static string GetEnvironmentConfigValue(XmlDocument configDocument, string environment, string configKey) { DebugGuard.ArgumentIsNotNull(configDocument, "configDocument"); DebugGuard.ArgumentIsNotNullOrEmpty(environment, "environment"); DebugGuard.ArgumentIsNotNullOrEmpty(configKey, "configKey"); var xpath = string.Format("/config/{0}/entry[@key='{1}']", environment, configKey); var xmlNode = configDocument.SelectSingleNode(xpath); if (xmlNode == null) { throw new Exception( string.Format( "Could not find configuration entry {0} for environment {1} in Environment Configuration XML.", configKey, environment)); } return(xmlNode.InnerText); }
private void LoadEnvironmentConfiguration(string environment) { DebugGuard.ArgumentIsNotNullOrEmpty(environment, "environment"); var configDocument = new XmlDocument(); configDocument.LoadXml(ResourceFiles.EnvironmentConfiguration); this.Name = environment; environment = environment.ToLower(); this.ContentManagerUrl = GetEnvironmentConfigValue(configDocument, environment, "ContentManagerUrl"); this.LiveHostName = GetEnvironmentConfigValue(configDocument, environment, "LiveHostname"); this.MediaManagerHostName = GetEnvironmentConfigValue(configDocument, environment, "MediaManagerHostname"); this.StagingHostName = GetEnvironmentConfigValue(configDocument, environment, "StagingHostname"); this.StagingTargetUri = GetEnvironmentConfigValue(configDocument, environment, "StagingTargetUri"); this.TempFolderPath = GetEnvironmentConfigValue(configDocument, environment, "TempFolderPath"); this.StagingUrl = "http://" + this.StagingHostName; this.PreviewUrl = this.StagingUrl; this.StagingSecureUrl = "https://" + this.StagingHostName; this.LiveUrl = "http://" + this.LiveHostName; this.LiveSecureUrl = "https://" + this.LiveHostName; }