NovoNordisk.Configuration.AzureBlob
1.0.1
dotnet add package NovoNordisk.Configuration.AzureBlob --version 1.0.1
NuGet\Install-Package NovoNordisk.Configuration.AzureBlob -Version 1.0.1
<PackageReference Include="NovoNordisk.Configuration.AzureBlob" Version="1.0.1" />
<PackageVersion Include="NovoNordisk.Configuration.AzureBlob" Version="1.0.1" />
<PackageReference Include="NovoNordisk.Configuration.AzureBlob" />
paket add NovoNordisk.Configuration.AzureBlob --version 1.0.1
#r "nuget: NovoNordisk.Configuration.AzureBlob, 1.0.1"
#addin nuget:?package=NovoNordisk.Configuration.AzureBlob&version=1.0.1
#tool nuget:?package=NovoNordisk.Configuration.AzureBlob&version=1.0.1
Azure Blob Storage Configuration Provider
This is a configuration provider for the built-in Configuration API, for reading JSON configuration files from Azure Blob Storage.
Features:
- Authentication via Azure token credential
- Reloadable config, with adjustable cadence
- Invoke
Action
on exception
Installation
You can install the library via NuGet:
dotnet add package NovoNordisk.Configuration.AzureBlob
Usage
To get started, all you need is the URL for the specific blob you want to load.
var blobUrl = new Uri("...");
builder.Configuration.AddJsonBlob(blobUrl);
This requires the blob to be public. If you need to use Azure credentials to access the blob, these can be passed to the AddJsonBlob
method.
var blobUrl = new Uri("...");
builder.Configuration.AddJsonBlob(blobUrl, tokenCredential: new DefaultAzureCredential());
By default, the blob is read on first use, and kept in the application. If the file is changed, and you want the application to react/update when the file changes, you need to enable reload.
var blobUrl = new Uri("...");
builder.Configuration.AddJsonBlob(blobUrl, reloadOnChange: true);
This will check the ETag on the file every 30 seconds. If you want to use a different cadence, you can specify a timespan for the delay between checks.
var blobUrl = new Uri("...");
builder.Configuration.AddJsonBlob(blobUrl, reloadOnChange: true, pollingInterval: TimeSpan.FromMinutes(5));
If, for any reason, an error occurs during a reload, you can specify an exception handler to be invoked.
var blobUrl = new Uri("...");
configurationBuilder.AddJsonBlob(blobUrl, exceptionHandler: exception =>
{
Console.WriteLine(exception.Message);
});
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
References
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Azure.Core (>= 1.46.1)
- Azure.Storage.Blobs (>= 12.24.0)
- Microsoft.Extensions.Configuration (>= 9.0.4)
-
net9.0
- Azure.Core (>= 1.46.1)
- Azure.Storage.Blobs (>= 12.24.0)
- Microsoft.Extensions.Configuration (>= 9.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.