Voyager.Configuration.MountPath
1.0.1
See the version list below for details.
dotnet add package Voyager.Configuration.MountPath --version 1.0.1
NuGet\Install-Package Voyager.Configuration.MountPath -Version 1.0.1
<PackageReference Include="Voyager.Configuration.MountPath" Version="1.0.1" />
paket add Voyager.Configuration.MountPath --version 1.0.1
#r "nuget: Voyager.Configuration.MountPath, 1.0.1"
// Install Voyager.Configuration.MountPath as a Cake Addin #addin nuget:?package=Voyager.Configuration.MountPath&version=1.0.1 // Install Voyager.Configuration.MountPath as a Cake Tool #tool nuget:?package=Voyager.Configuration.MountPath&version=1.0.1
Voyager.Configuration.MountPath
The extension for AspNetCore to organize JSON configuration.
About
The nuget allows reading the JSON configuration files from a path. The path can be used by an environment like Linux, Docker, or Kubernetes to update the content by a mounting mechanism. In providing the library by docker images you will gain the possibility to avoid publishing your sensitive data in an image repository.
🏁 Getting Started
Prerequisites
The library menage configuration is supplied by the JSON files. Cooperate with the WebApplicationBuilder or HostApplicationBuilder. Linux mount mechanism can only work with folders so the config files have to be in that folder.
🔧 How to start
The best metod to see how it worsk is look to the thest project.
The default configuration
builder.ConfigureAppConfiguration((hostingConfiguration, config) =>
{
config.AddMountConfiguration(hostingConfiguration.HostingEnvironment.GetSettingsProvider());
});
The default configuration will work with the files structures:
YourAppFiles
|--bin
|--config
|--appsettings.json
|--appsettings.Development.json
It works in the way that from the folder config will load appsettings.json. The dotnet from the ASPNETCORE_ENVIRONMENT set his HostEnviroment variable, and if is setted with value: Development the program finds the appsettings.Development.json file and will use it to override previous settings.
🔧 How to update default settings
The library is open for extensions so it is possible to modify behavior. At the first, it is possible to make the obligation to possess a hosting file:
builder.ConfigureAppConfiguration((hostingConfiguration, config) =>
{
config.AddMountConfiguration(hostingConfiguration.HostingEnvironment.GetSettingsProviderForce());
});
The second possibility is to override the class Voyager.Configuration.MountPath.SettingsProvider and use the instance in the AddMountConfiguration method.
Also is possible to use the AddMountConfiguration with the action that is can change all settings.
builder.ConfigureAppConfiguration((hostingConfiguration, config) =>
{
config.AddMountConfiguration(settings =>
{
settings.HostingName = "MyEnv";
settings.Optional = false;
});
});
✍️ Authors
- @andrzejswistowski - Idea & work. Please let me know if you find out an error or suggestions.
🎉 Acknowledgements
- Przemysław Wróbel - for the icon.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.Configuration.Json (>= 7.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.