Skip to content

Commit 2bcd2f6

Browse files
Cleanup solution + update docs
1 parent 439688f commit 2bcd2f6

20 files changed

+126
-111
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ Update `~/Config/FileSystemProviders.config` replacing the default provider with
5858
Defaults to 365 days.
5959
-->
6060
<add key="maxDays" value="365" />
61+
<!--
62+
When true this allows the VirtualPathProvider to use the default "media" route prefix regardless
63+
of the container name.
64+
-->
65+
<add key="useDefaultRoute" value="true" />
66+
<!--
67+
When true blob containers will be private instead of public what means that you can't access the original blob file directly from its blob url.
68+
-->
69+
<add key="usePrivateContainer" value="false" />
6170
</Parameters>
6271
</Provider>
6372
</FileSystemProviders>
@@ -124,6 +133,7 @@ In `Web.config` create the new application keys and post fix each key with the `
124133
<add key="AzureBlobFileSystem.RootUrl:media" value="http://[myAccountName].blob.core.windows.net/" />
125134
<add key="AzureBlobFileSystem.MaxDays:media" value="365" />
126135
<add key="AzureBlobFileSystem.UseDefaultRoute:media" value="true" />
136+
<add key="AzureBlobFileSystem.UsePrivateContainer" value="false" />
127137
```
128138

129139
## Virtual Path Provider
@@ -164,7 +174,8 @@ For **Umbraco v7.5+ you must add the the StaticFileHandler** to the new Web.conf
164174

165175
## Combining with ImageProcessor
166176

167-
As of ImageProcessor.Web version [4.3.2](https://www.nuget.org/packages/ImageProcessor.Web/4.3.2) a new [`IImageService`](http://imageprocessor.org/imageprocessor-web/extending/#iimageservice) implementation has been available called `CloudImageService`. To enable that service and pull images directly from the cloud simply install the [configuration package](https://www.nuget.org/packages/ImageProcessor.Web.Config/) and replace the `CloudImageService`setting with the following:
177+
As of ImageProcessor.Web version [4.3.2](https://www.nuget.org/packages/ImageProcessor.Web/4.3.2) a new [`IImageService`](http://imageprocessor.org/imageprocessor-web/extending/#iimageservice) implementation has been available called `CloudImageService`. To enable that service and pull images directly from
178+
the cloud simply install the [configuration package](https://www.nuget.org/packages/ImageProcessor.Web.Config/) and replace the `CloudImageService`setting with the following:
168179

169180
```xml
170181
<?xml version="1.0"?>
@@ -181,6 +192,8 @@ As of ImageProcessor.Web version [4.3.2](https://www.nuget.org/packages/ImagePro
181192
</services>
182193
</security>
183194
```
195+
**Note** The `CloudImageService`is not compatible with the FileSystemProvider when using private storage. You will have to build your own `IImageService` implementation.
196+
184197
If using a version of ImageProcessor.Web version [4.5.0](https://www.nuget.org/packages/ImageProcessor.Web/4.5.0) the configuration details will need to be configured as follows:
185198

186199
```xml

src/UmbracoFileSystemProviders.Azure.Installer/Models/Parameter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer.Models
1313
public class Parameter
1414
{
1515
/// <summary>
16-
/// The key.
16+
/// Gets or sets the key.
1717
/// </summary>
1818
[JsonProperty("key")]
1919
public string Key { get; set; }
2020

2121
/// <summary>
22-
/// The value.
22+
/// Gets or sets the value.
2323
/// </summary>
2424
[JsonProperty("value")]
2525
public string Value { get; set; }

src/UmbracoFileSystemProviders.Azure.Installer/PackageActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private bool Transform(string packageName, XmlNode xmlData, bool uninstall = fal
6767

6868
string sourceDocFileName = VirtualPathUtility.ToAbsolute(file);
6969

70-
// The xdt file used for tranformation
70+
// The xdt file used for tranformation
7171
string fileEnd = "install.xdt";
7272
if (uninstall)
7373
{

src/UmbracoFileSystemProviders.Azure.Installer/Properties/AssemblyInfo.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
using System.Reflection;
1+
// <copyright file="AssemblyInfo.cs" company="James Jackson-South, Jeavon Leopold, and contributors">
2+
// Copyright (c) James Jackson-South, Jeavon Leopold, and contributors. All rights reserved.
3+
// Licensed under the Apache License, Version 2.0.
4+
// </copyright>
5+
6+
using System.Reflection;
27
using System.Runtime.CompilerServices;
38
using System.Runtime.InteropServices;
49

5-
// General Information about an assembly is controlled through the following
10+
// General Information about an assembly is controlled through the following
611
// set of attributes. Change these attribute values to modify the information
712
// associated with an assembly.
813
[assembly: AssemblyTitle("UmbracoFileSystemProviders.Azure.Installer")]
@@ -14,8 +19,8 @@
1419
[assembly: AssemblyTrademark("")]
1520
[assembly: AssemblyCulture("")]
1621

17-
// Setting ComVisible to false makes the types in this assembly not visible
18-
// to COM components. If you need to access a type in this assembly from
22+
// Setting ComVisible to false makes the types in this assembly not visible
23+
// to COM components. If you need to access a type in this assembly from
1924
// COM, set the ComVisible attribute to true on that type.
2025
[assembly: ComVisible(false)]
2126

src/UmbracoFileSystemProviders.Azure.Installer/Properties/VersionInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// <copyright file="VersionInfo.cs" company="James Jackson-South">
2-
// Copyright (c) James Jackson-South. All rights reserved.
1+
// <copyright file="VersionInfo.cs" company="James Jackson-South, Jeavon Leopold, and contributors">
2+
// Copyright (c) James Jackson-South, Jeavon Leopold, and contributors. All rights reserved.
33
// Licensed under the Apache License, Version 2.0.
44
// </copyright>
55

@@ -8,11 +8,11 @@
88
// Version information for an assembly consists of the following four values:
99
//
1010
// Major Version
11-
// Minor Version
11+
// Minor Version
1212
// Build Number
1313
// Revision
1414
//
15-
// You can specify all the values or you can default the Build and Revision Numbers
15+
// You can specify all the values or you can default the Build and Revision Numbers
1616
// by using the '*' as shown below:
1717
// [assembly: AssemblyVersion("0.5.0.10")]
1818
[assembly: AssemblyVersion("0.5.0.0")]

src/UmbracoFileSystemProviders.Azure.Tests/AzureBlobFileSystemAbsoluteTests.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="AzureBlobFileSystemAbsoluteTests.cs" company="James Jackson-South">
3-
// Copyright (c) James Jackson-South and contributors.
4-
// Licensed under the Apache License, Version 2.0.
1+
// <copyright file="AzureBlobFileSystemAbsoluteTests.cs" company="James Jackson-South and contributors">
2+
// Copyright (c) James Jackson-South and contributors. All rights reserved.
3+
// Licensed under the Apache License, Version 2.0.
54
// </copyright>
6-
// <summary>
7-
// The <see cref="AzureBlobFileSystem" /> absolute tests.
8-
// </summary>
9-
// --------------------------------------------------------------------------------------------------------------------
105

116
namespace Our.Umbraco.FileSystemProviders.Azure.Tests
127
{

src/UmbracoFileSystemProviders.Azure.Tests/AzureBlobFileSystemRelativeTests.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="AzureBlobFileSystemRelativeTests.cs" company="James Jackson-South">
3-
// Copyright (c) James Jackson-South and contributors.
4-
// Licensed under the Apache License, Version 2.0.
1+
// <copyright file="AzureBlobFileSystemRelativeTests.cs" company="James Jackson-South and contributors">
2+
// Copyright (c) James Jackson-South and contributors. All rights reserved.
3+
// Licensed under the Apache License, Version 2.0.
54
// </copyright>
6-
// <summary>
7-
// The <see cref="AzureBlobFileSystem" /> relative tests.
8-
// </summary>
9-
// --------------------------------------------------------------------------------------------------------------------
105

116
namespace Our.Umbraco.FileSystemProviders.Azure.Tests
127
{

src/UmbracoFileSystemProviders.Azure.Tests/AzureBlobFileSystemTestsBase.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="AzureBlobFileSystemTestsBase.cs" company="James Jackson-South">
3-
// Copyright (c) James Jackson-South and contributors.
4-
// Licensed under the Apache License, Version 2.0.
1+
// <copyright file="AzureBlobFileSystemTestsBase.cs" company="James Jackson-South and contributors">
2+
// Copyright (c) James Jackson-South and contributors. All rights reserved.
3+
// Licensed under the Apache License, Version 2.0.
54
// </copyright>
6-
// <summary>
7-
// The <see cref="AzureBlobFileSystem" /> tests base.
8-
// </summary>
9-
// --------------------------------------------------------------------------------------------------------------------
10-
11-
using System.Threading;
125

136
namespace Our.Umbraco.FileSystemProviders.Azure.Tests
147
{
@@ -17,9 +10,8 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Tests
1710
using System.IO;
1811
using System.Linq;
1912
using System.Text;
20-
13+
using System.Threading;
2114
using Moq;
22-
2315
using NUnit.Framework;
2416

2517
/// <summary>
@@ -142,7 +134,7 @@ public void TestFileExists()
142134
}
143135

144136
/// <summary>
145-
/// Asserts that the file system correctly determines whether a file exists
137+
/// Asserts that the file system correctly determines whether a file exists
146138
/// when the input has been prefixed.
147139
/// </summary>
148140
[Test]
@@ -319,7 +311,7 @@ public void TestGetDirectoriesPrefixed()
319311
string[] expected = { "1010", "1011", "1012" };
320312
Assert.IsTrue(expected.SequenceEqual(actual));
321313
}
322-
314+
323315
/// <summary>
324316
/// Asserts that the file system correctly returns a sequence of files from the root
325317
/// container in the correct format.
@@ -365,7 +357,7 @@ public void TestGetFilesFromRootFiltered()
365357
}
366358

367359
/// <summary>
368-
/// Asserts that the file system correctly returns a sequence of files from a
360+
/// Asserts that the file system correctly returns a sequence of files from a
369361
/// subfolder in the correct format.
370362
/// </summary>
371363
[Test]
@@ -456,6 +448,9 @@ public void TestDeleteDirectory()
456448
Assert.IsFalse(provider.FileExists("1010/media.jpg"));
457449
}
458450

451+
/// <summary>
452+
/// Asserts that the file system correctly creates a directory.
453+
/// </summary>
459454
[Test]
460455
public void TestValidDirectory()
461456
{
@@ -467,6 +462,9 @@ public void TestValidDirectory()
467462
provider.DeleteDirectory("testvalid");
468463
}
469464

465+
/// <summary>
466+
/// Asserts that the file system does not automatically create a directory.
467+
/// </summary>
470468
[Test]
471469
public void TestInvalidDirectory()
472470
{
@@ -498,6 +496,9 @@ public void TestDeleteDirectoryPrefixed()
498496
Assert.IsFalse(provider.FileExists("media/1010/media.jpg"));
499497
}
500498

499+
/// <summary>
500+
/// Asserts that the file system correctly deletes a relative directory and file.
501+
/// </summary>
501502
[Test]
502503
public void TestDeleteDirectoryRelative()
503504
{

src/UmbracoFileSystemProviders.Azure.Tests/FileSystemVirtualPathProviderTests.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="FileSystemVirtualPathProviderTests.cs" company="James Jackson-South">
3-
// Copyright (c) James Jackson-South and contributors.
4-
// Licensed under the Apache License, Version 2.0.
1+
// <copyright file="FileSystemVirtualPathProviderTests.cs" company="James Jackson-South and contributors">
2+
// Copyright (c) James Jackson-South and contributors. All rights reserved.
3+
// Licensed under the Apache License, Version 2.0.
54
// </copyright>
6-
// <summary>
7-
// The <see cref="FileSystemVirtualPathProvider" /> tests.
8-
// </summary>
9-
// --------------------------------------------------------------------------------------------------------------------
105

116
namespace Our.Umbraco.FileSystemProviders.Azure.Tests
127
{
138
using System;
149
using System.IO;
1510
using System.Web.Hosting;
16-
11+
using Azure;
12+
using global::Umbraco.Core.IO;
1713
using Moq;
18-
1914
using NUnit.Framework;
2015

21-
using Our.Umbraco.FileSystemProviders.Azure;
22-
23-
using global::Umbraco.Core.IO;
24-
2516
/// <summary>
2617
/// The <see cref="FileSystemVirtualPathProvider"/> tests.
2718
/// </summary>
Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,60 @@
1-
// --------------------------------------------------------------------------------------------------------------------
2-
// <copyright file="InstallerTests.cs" company="James Jackson-South">
3-
// Copyright (c) James Jackson-South and contributors.
4-
// Licensed under the Apache License, Version 2.0.
1+
// <copyright file="InstallerTests.cs" company="James Jackson-South and contributors">
2+
// Copyright (c) James Jackson-South and contributors. All rights reserved.
3+
// Licensed under the Apache License, Version 2.0.
54
// </copyright>
6-
// --------------------------------------------------------------------------------------------------------------------
5+
76
namespace Our.Umbraco.FileSystemProviders.Azure.Tests
87
{
8+
using System.Collections.Generic;
99
using System.Linq;
10-
using NUnit.Framework;
11-
10+
using Azure.Installer.Models;
1211
using Installer;
12+
using NUnit.Framework;
1313

14+
/// <summary>
15+
/// Tests the Umbraco installer
16+
/// </summary>
1417
[TestFixture]
1518
public class InstallerTests
1619
{
20+
/// <summary>
21+
/// Asserts that the first parameter is correct.
22+
/// </summary>
1723
[Test]
1824
public void CheckXdtFirstParameterKey()
1925
{
20-
var parameters = InstallerController.GetParametersFromXml("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt");
26+
IEnumerable<Parameter> parameters = InstallerController.GetParametersFromXml("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt");
2127
Assert.AreEqual("containerName", parameters.First().Key);
2228
}
2329

30+
/// <summary>
31+
/// Asserts that the parameter count is correct.
32+
/// </summary>
2433
[Test]
2534
public void CheckXdtNumberOfParameters()
2635
{
27-
var parameters = InstallerController.GetParametersFromXml("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt");
36+
IEnumerable<Parameter> parameters = InstallerController.GetParametersFromXml("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt");
2837
Assert.AreEqual(6, parameters.Count());
2938
}
3039

40+
/// <summary>
41+
/// Asserts that the "rootUrl" parameter is correct on upgrade.
42+
/// </summary>
3143
[Test]
3244
public void CheckUpgradeRootUrlParameter()
3345
{
34-
var parameters = InstallerController.GetParametersFromXdt("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt", "FileSystemProviders.upgrade.config");
46+
IEnumerable<Parameter> parameters = InstallerController.GetParametersFromXdt("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt", "FileSystemProviders.upgrade.config");
3547
Assert.AreEqual("http://existing123456789.blob.core.windows.net/", parameters.Single(k => k.Key == "rootUrl").Value);
3648
}
3749

50+
/// <summary>
51+
/// Asserts that the "rootUrl" parameter is correct.
52+
/// </summary>
3853
[Test]
3954
public void CheckNewInstallDefaultConfig()
4055
{
41-
var parameters = InstallerController.GetParametersFromXdt("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt", "FileSystemProviders.default.config");
56+
IEnumerable<Parameter> parameters = InstallerController.GetParametersFromXdt("..\\..\\build\\transforms\\FileSystemProviders.config.install.xdt", "FileSystemProviders.default.config");
4257
Assert.AreEqual("http://[myAccountName].blob.core.windows.net/", parameters.Single(k => k.Key == "rootUrl").Value);
4358
}
4459
}
45-
}
60+
}

0 commit comments

Comments
 (0)