It may have happened to you that your project involved many configurations and you had to put them all in one file called appsettings.json. Well, everything is fine and there is no problem, but we at uBeac.Configuration offer you a more attractive solution.
Our suggestion is to create a file for each configuration and put it in a folder. For example, we have a folder called Config that contains various JSON configuration files (like connection-strings.json, authentication.json, smtp.json or anything else.)
Install the package with NuGet:
dotnet add package uBeac.Configuration
Just put the following code in Program.cs:
builder.Configuration.AddJsonConfig(builder.Environment, "YourConfigFolderName");
"YourConfigFolderName"is the name of the folder in which your JSON files are located. Default is"Config".
For example:
- Config
- connection-strings.json
- authentication.json
- smtp.json
In this example, folder name is
Configwhich contains JSON files.
The
Configfolder must be at the root of the project.