Skip to content

Commit 96a0237

Browse files
Remove build warnings
1 parent 8000d7b commit 96a0237

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/Umbraco.Cloud.StorageProviders.AzureBlob/AzureBlobComposer.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,29 @@ namespace Umbraco.Cloud.StorageProviders.AzureBlob
1010
/// Automatically configures Azure Blob Storage for use on Umbraco Cloud.
1111
/// </summary>
1212
/// <seealso cref="Umbraco.Cms.Core.Composing.IComposer" />
13-
public class AzureBlobComposer : IComposer
13+
public sealed class AzureBlobComposer : IComposer
1414
{
1515
/// <inheritdoc />
1616
public void Compose(IUmbracoBuilder builder)
1717
{
18-
if (builder == null) throw new ArgumentNullException(nameof(builder));
18+
ArgumentNullException.ThrowIfNull(builder);
1919

20-
/* There's a bug in Microsoft.Extensions.Configuration.EnvironmentVariables @ 6.0.0 WRT env var normalization + AddEnvironmentVariables(prefix)
21-
* See https://github.com/dotnet/runtime/pull/62916, should be resolved upstream in https://github.com/dotnet/runtime/milestone/87
22-
* Until then, safest thing to do is explicitly add environment variables using both prefixes.
23-
* (otherwise there are issues when folks update TFM to net6) */
2420
var configuration = new ConfigurationBuilder()
2521
.AddEnvironmentVariables("Umbraco:Cloud:")
26-
.AddEnvironmentVariables("Umbraco__Cloud__")
2722
.Build();
2823

2924
// Get options and manually validate (no need to add them to the service collection)
3025
var azureBlobOptions = configuration.GetSection("Storage:AzureBlob").Get<AzureBlobOptions>();
31-
if (azureBlobOptions == null) return;
26+
if (azureBlobOptions == null)
27+
{
28+
return;
29+
}
3230

3331
var validateResult = new DataAnnotationValidateOptions<AzureBlobOptions>(null).Validate(null, azureBlobOptions);
34-
if (validateResult.Failed) return;
32+
if (validateResult.Failed)
33+
{
34+
return;
35+
}
3536

3637
// Configure Azure Blob Storage
3738
builder.AddAzureBlobMediaFileSystem(options =>

src/Umbraco.Cloud.StorageProviders.AzureBlob/AzureBlobOptions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using System.ComponentModel.DataAnnotations;
2+
using System.Diagnostics.CodeAnalysis;
23

34
namespace Umbraco.Cloud.StorageProviders.AzureBlob
45
{
56
/// <summary>
67
/// The Azure Blob options used on Umbraco Cloud.
78
/// </summary>
8-
internal class AzureBlobOptions
9+
[SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Used in configuration binding.")]
10+
internal sealed class AzureBlobOptions
911
{
1012
/// <summary>
1113
/// Gets or sets the endpoint.

0 commit comments

Comments
 (0)