Skip to content

Commit

Permalink
Merge branch 'develop-umbraco-version-8' into master-umbraco-version-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeavon committed Mar 23, 2021
2 parents d787205 + 3b9518b commit 0e8d1a5
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 26 deletions.
12 changes: 6 additions & 6 deletions README.md
@@ -1,6 +1,6 @@
# UmbracoFileSystemProviders.Azure v2

**This version is for Umbraco v8 only**. For the v1 package for **Umbraco v7** please visit the [main branch](https://github.com/umbraco-community/UmbracoFileSystemProviders.Azure/tree/develop)
**This version is for Umbraco v8 only**. For the v1 package for **Umbraco v7** please visit the [develop branch](https://github.com/umbraco-community/UmbracoFileSystemProviders.Azure/tree/develop)

![Image Alt](build/assets/logo/azure-logo-256.png)

Expand All @@ -23,17 +23,17 @@ From **v2.0.0-alpha3** onwards this package was split into 2 NuGet packages and

|NuGet Packages |Version |
|:-----------------|:-----------------|
|**Pre-Release Core**|[![NuGet download](http://img.shields.io/nuget/vpre/UmbracoFileSystemProviders.Azure.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/)|
|**Pre-Release Media**|[![NuGet download](http://img.shields.io/nuget/vpre/UmbracoFileSystemProviders.Azure.Media.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Media/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.Media.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Media/)|
|**Pre-Release Forms**|[![NuGet download](http://img.shields.io/nuget/vpre/UmbracoFileSystemProviders.Azure.Forms.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Forms/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.Forms.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Forms/)|
|**Release Core**|[![NuGet download](http://img.shields.io/nuget/vpre/UmbracoFileSystemProviders.Azure.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/)|
|**Release Media**|[![NuGet download](http://img.shields.io/nuget/vpre/UmbracoFileSystemProviders.Azure.Media.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Media/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.Media.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Media/)|
|**Release Forms**|[![NuGet download](http://img.shields.io/nuget/vpre/UmbracoFileSystemProviders.Azure.Forms.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Forms/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.Forms.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure.Forms/)|
|**Bleeding edge Core**|[![MyGet download](https://img.shields.io/myget/umbraco-packages/vpre/UmbracoFileSystemProviders.Azure.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure)|[![MyGet count](https://img.shields.io/myget/umbraco-packages/dt/UmbracoFileSystemProviders.Azure.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure)|
|**Bleeding edge Media**|[![MyGet download](https://img.shields.io/myget/umbraco-packages/vpre/UmbracoFileSystemProviders.Azure.Media.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure.Media)|[![MyGet count](https://img.shields.io/myget/umbraco-packages/dt/UmbracoFileSystemProviders.Azure.Media.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure.Media)|
|**Bleeding edge Forms**|[![MyGet download](https://img.shields.io/myget/umbraco-packages/vpre/UmbracoFileSystemProviders.Azure.Forms.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure.Forms)|[![MyGet count](https://img.shields.io/myget/umbraco-packages/dt/UmbracoFileSystemProviders.Azure.Forms.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure.Forms)|

|Umbraco Packages | |
|:-----------------|:-----------------|
|**Release**|[![Our Umbraco project page](https://img.shields.io/badge/our-umbraco-orange.svg)](https://our.umbraco.org/projects/collaboration/umbracofilesystemprovidersazure/)
|**Pre-release**| [![AppVeyor Artifacts](https://img.shields.io/badge/appveyor-umbraco-orange.svg)](https://ci.appveyor.com/project/Umbraco-Community/umbracofilesystemproviders-azure/build/artifacts)
|**Bleeding edge**| [![AppVeyor Artifacts](https://img.shields.io/badge/appveyor-umbraco-orange.svg)](https://ci.appveyor.com/project/Umbraco-Community/umbracofilesystemproviders-azure/build/artifacts)

## Manual build

Expand Down Expand Up @@ -147,7 +147,7 @@ Optionally install the [AzureBlobCache](http://imageprocessor.org/imageprocessor

Currently this package is available only via NuGet

Install-Package UmbracoFileSystemProviders.Azure.Forms -pre
Install-Package UmbracoFileSystemProviders.Azure.Forms

### Configuration via Web.Config

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
@@ -1,4 +1,4 @@
version: 2.0.0.{build}
version: 2.0.1.{build}

os: Visual Studio 2019

Expand All @@ -9,7 +9,7 @@ configuration: Release

environment:
# Version Suffix
version_suffix: beta3
version_suffix: alpha

install:
- ps: .\build\appveyor-semver.ps1
Expand Down
6 changes: 3 additions & 3 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/package.json
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"jsonfile": "^2.2.3",
"semver": "^5.0.3",
"xmldom": "^0.1.27",
"xmldom": "^0.5.0",
"read-file": "^0.2.0",
"write": "^0.3.2",
"js-yaml": "^3.7.0"
Expand Down
Expand Up @@ -447,8 +447,8 @@ private static bool ExecuteImageProcessorSecurityConfigTransform()

private static bool TestAzureCredentials(string connectionString, string containerName, BlobContainerPublicAccessType accessType)
{
bool useEmulator = ConfigurationManager.AppSettings[Azure.Constants.Configuration.UseStorageEmulatorKey] != null
&& ConfigurationManager.AppSettings[Azure.Constants.Configuration.UseStorageEmulatorKey]
bool useEmulator = ConfigurationHelper.GetAppSetting(Azure.Constants.Configuration.UseStorageEmulatorKey) != null
&& ConfigurationHelper.GetAppSetting(Azure.Constants.Configuration.UseStorageEmulatorKey)
.Equals("true", StringComparison.InvariantCultureIgnoreCase);
try
{
Expand Down
12 changes: 6 additions & 6 deletions src/UmbracoFileSystemProviders.Azure/AzureBlobFileSystem.cs
Expand Up @@ -113,34 +113,34 @@ public AzureBlobFileSystem(string containerName, string rootUrl, string connecti
/// <param name="alias">The alias of the provider</param>
public AzureBlobFileSystem(string alias)
{
string connectionString = ConfigurationManager.AppSettings[$"{ConnectionStringKey}:{alias}"];
string connectionString = ConfigurationHelper.GetAppSetting(ConnectionStringKey,alias);
if (!string.IsNullOrWhiteSpace(connectionString))
{
string rootUrl = ConfigurationManager.AppSettings[$"{RootUrlKey}:{alias}"];
string rootUrl = ConfigurationHelper.GetAppSetting(RootUrlKey,alias);
if (string.IsNullOrWhiteSpace(rootUrl))
{
throw new InvalidOperationException("Azure Storage Root URL is not defined in application settings. The " + RootUrlKey + " property was not defined or is empty.");
}

string containerName = ConfigurationManager.AppSettings[$"{ContainerNameKey}:{alias}"];
string containerName = ConfigurationHelper.GetAppSetting(ContainerNameKey,alias);
if (string.IsNullOrWhiteSpace(containerName))
{
containerName = "media";
}

string maxDays = ConfigurationManager.AppSettings[$"{MaxDaysKey}:{alias}"];
string maxDays = ConfigurationHelper.GetAppSetting(MaxDaysKey,alias);
if (string.IsNullOrWhiteSpace(maxDays))
{
maxDays = "365";
}

string useDefaultRoute = ConfigurationManager.AppSettings[$"{UseDefaultRootKey}:{alias}"];
string useDefaultRoute = ConfigurationHelper.GetAppSetting(UseDefaultRootKey,alias);
if (string.IsNullOrWhiteSpace(useDefaultRoute))
{
useDefaultRoute = "true";
}

string accessType = ConfigurationManager.AppSettings[$"{UsePrivateContainerKey}:{alias}"];
string accessType = ConfigurationHelper.GetAppSetting(UsePrivateContainerKey,alias);
if (string.IsNullOrWhiteSpace(accessType))
{
accessType = "true";
Expand Down
10 changes: 5 additions & 5 deletions src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs
Expand Up @@ -96,12 +96,12 @@ internal AzureFileSystem(string containerName, string rootUrl, string connection
throw new ArgumentNullException(nameof(containerName));
}

this.DisableVirtualPathProvider = ConfigurationManager.AppSettings[DisableVirtualPathProviderKey] != null
&& ConfigurationManager.AppSettings[DisableVirtualPathProviderKey]
this.DisableVirtualPathProvider = ConfigurationHelper.GetAppSetting(DisableVirtualPathProviderKey) != null
&& ConfigurationHelper.GetAppSetting(DisableVirtualPathProviderKey)
.Equals("true", StringComparison.InvariantCultureIgnoreCase);

bool useEmulator = ConfigurationManager.AppSettings[UseStorageEmulatorKey] != null
&& ConfigurationManager.AppSettings[UseStorageEmulatorKey]
bool useEmulator = ConfigurationHelper.GetAppSetting(UseStorageEmulatorKey) != null
&& ConfigurationHelper.GetAppSetting(UseStorageEmulatorKey)
.Equals("true", StringComparison.InvariantCultureIgnoreCase);

CloudStorageAccount cloudStorageAccount;
Expand Down Expand Up @@ -780,7 +780,7 @@ public static CloudBlobContainer CreateContainer(CloudBlobClient cloudBlobClient
/// <returns>
/// The <see cref="CloudBlockBlob"/> reference.
/// </returns>
private CloudBlockBlob GetBlockBlobReference(string path)
public CloudBlockBlob GetBlockBlobReference(string path)
{
Current.Logger.Debug<AzureBlobFileSystem>($"GetBlockBlobReference(path) method executed with path:{path}");

Expand Down
Expand Up @@ -4,9 +4,27 @@

public class ConfigurationHelper
{
public static string GetAppSetting(string key)
{
var settings = ConfigurationManager.AppSettings[key];

if (!string.IsNullOrEmpty(settings))
{
return settings;
}

return ConfigurationManager.AppSettings[key.Replace(".", "-")];
}
public static string GetAppSetting(string key, string providerAlias)
{
return ConfigurationManager.AppSettings[$"{key}:{providerAlias}"];
var settings = ConfigurationManager.AppSettings[$"{key}:{providerAlias}"];

if (!string.IsNullOrEmpty(settings))
{
return settings;
}

return ConfigurationManager.AppSettings[$"{key.Replace(".", "-")}-{providerAlias}"];
}
}
}

0 comments on commit 0e8d1a5

Please sign in to comment.