/// <summary> /// Gets the storage configuration. /// </summary> /// <param name="serviceSection">The service section.</param> /// <returns> /// Storage Configuration /// </returns> protected override ICmsStorageConfiguration GetStorageConfiguration(CmsTestConfigurationSection serviceSection) { var accessKey = serviceSection.AmazonStorage.GetValue(AmazonAccessKey); var secretKey = serviceSection.AmazonStorage.GetValue(AmazonSecretKey); if (!string.IsNullOrWhiteSpace(accessKey) && !string.IsNullOrWhiteSpace(secretKey)) { return(serviceSection.AmazonStorage); } accessKey = Environment.GetEnvironmentVariable("BETTERCMS_AMAZON_STORAGE_ACCESS_KEY", EnvironmentVariableTarget.Machine); secretKey = Environment.GetEnvironmentVariable("BETTERCMS_AMAZON_STORAGE_SECRET_KEY", EnvironmentVariableTarget.Machine); if (!string.IsNullOrWhiteSpace(accessKey) || !string.IsNullOrWhiteSpace(secretKey)) { var bucketName = Environment.GetEnvironmentVariable("BETTERCMS_AMAZON_STORAGE_BUCKET_NAME", EnvironmentVariableTarget.Machine); var configuration = new CmsStorageConfigurationElement { ContentRoot = Environment.GetEnvironmentVariable("BETTERCMS_AMAZON_STORAGE_CONTENT_ROOT", EnvironmentVariableTarget.Machine), PublicContentUrlRoot = Environment.GetEnvironmentVariable("BETTERCMS_AMAZON_STORAGE_PUBLIC_CONTENT_ROOT", EnvironmentVariableTarget.Machine), ServiceType = StorageServiceType.Auto, ProcessTimeout = serviceSection.AmazonStorage.ProcessTimeout }; configuration.Add(new KeyValueElement { Key = AmazonAccessKey, Value = accessKey }); configuration.Add(new KeyValueElement { Key = AmazonSecretKey, Value = secretKey }); configuration.Add(new KeyValueElement { Key = AmazonBucketName, Value = bucketName }); return(configuration); } return(null); }
/// <summary> /// Gets the storage configuration. /// </summary> /// <param name="serviceSection">The service section.</param> /// <returns>Storage Configuration</returns> protected abstract ICmsStorageConfiguration GetStorageConfiguration(CmsTestConfigurationSection serviceSection);