Skip to content

Commit 03fc325

Browse files
committed
Shifted the blog storage connection string to the AzureSettings class, as it makes for neater and easier to read config.
1 parent 821a996 commit 03fc325

File tree

5 files changed

+13
-31
lines changed

5 files changed

+13
-31
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ This library contains services, abstractions and helpers for running in an Azure
1515

1616
## Settings
1717

18-
- **Cofoundry:Plugins:AzureBlobFileService:ConnectionString** The connection string to use when accessing files in blob storage
19-
- **Cofoundry:Plugins:Azure:AutoRegisterServices:** Indicates whether to automatically register azure services. Defaults to true, but you may want to set this as false if developing locally
18+
- **Cofoundry:Plugins:Azure:BlobStorageConnectionString** The connection string to use when accessing files in blob storage.
19+
- **Cofoundry:Plugins:Azure:Disabled:** Indicates whether the plugin should be disabled, which means services will not be bootstrapped. Disable this in dev when you want to run using the standard non-cloud services. Defaults to false.
2020

2121

2222

src/Cofoundry.Plugins.Azure/AzureBlobFileService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ public class AzureBlobFileService : IFileStoreService
2525
private static ConcurrentBag<string> _initializedContainers2 = new ConcurrentBag<string>();
2626

2727
public AzureBlobFileService(
28-
AzureBlobFileServiceSettings settings
28+
AzureSettings settings
2929
)
3030
{
3131
if (settings == null) throw new ArgumentNullException(nameof(settings));
3232

33-
if (string.IsNullOrWhiteSpace(settings.ConnectionString))
33+
if (string.IsNullOrWhiteSpace(settings.BlobStorageConnectionString))
3434
{
35-
throw new InvalidConfigurationException(typeof(AzureBlobFileServiceSettings), "The ConnectionString is required to use the AzureBlobFileService");
35+
throw new InvalidConfigurationException(typeof(AzureSettings), "The BlobStorageConnectionString is required to use the AzureBlobFileService");
3636
}
3737

38-
var storageAccount = CloudStorageAccount.Parse(settings.ConnectionString);
38+
var storageAccount = CloudStorageAccount.Parse(settings.BlobStorageConnectionString);
3939
_blobClient = storageAccount.CreateCloudBlobClient();
4040
}
4141

src/Cofoundry.Plugins.Azure/AzureBlobFileServiceSettings.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Cofoundry.Plugins.Azure/AzureDependencyRegistration.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ public class AzureDependencyRegistration : IDependencyRegistration
1414
{
1515
public void Register(IContainerRegister container)
1616
{
17-
container
18-
.RegisterFactory<AzureBlobFileServiceSettings, ConfigurationSettingsFactory<AzureBlobFileServiceSettings>>()
19-
.RegisterFactory<AzureSettings, ConfigurationSettingsFactory<AzureSettings>>()
20-
;
21-
2217
if (container.Configuration.IsAzurePluginEnabled())
2318
{
2419
var delayedRegistrationOptions = RegistrationOptions.Override();

src/Cofoundry.Plugins.Azure/AzureSettings.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ public class AzureSettings : PluginConfigurationSettingsBase
1111
{
1212
/// <summary>
1313
/// Indicates whether the plugin should be disabled, which means services
14-
/// will not be boostrapped. Disable this in dev when you want to run using
15-
/// the standard non-cloud services.
14+
/// will not be bootstrapped. Disable this in dev when you want to run using
15+
/// the standard non-cloud services. Defaults to false.
1616
/// </summary>
1717
public bool Disabled { get; set; }
18+
19+
/// <summary>
20+
/// The connection string to use when accessing files in blob storage
21+
/// </summary>
22+
public string BlobStorageConnectionString { get; set; }
1823
}
1924
}

0 commit comments

Comments
 (0)