Adds comments

This commit is contained in:
Janus C. H. Knudsen 2025-02-11 23:32:28 +01:00
parent f4f2fc47b1
commit e3340b7c98
5 changed files with 52 additions and 9 deletions

View file

@ -6,6 +6,14 @@ namespace Core.Configurations.JsonConfigProvider
{
public static class JsonConfigExtension
{
/// <summary>
/// Adds a JSON configuration source to the configuration builder.
/// </summary>
/// <param name="builder">The configuration builder to add to</param>
/// <param name="configurationFilePath">Path to the JSON configuration file. Defaults to "appconfiguration.json"</param>
/// <param name="optional">If true, the configuration file is optional. Defaults to true</param>
/// <param name="reloadOnChange">If true, the configuration will be reloaded when the file changes. Defaults to false</param>
/// <returns>The configuration builder</returns>
public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, string configurationFilePath = "appconfiguration.json", bool? optional = true, bool? reloadOnChange = false)
{
return builder.AddProvider(new JsonConfigProvider(builder, configurationFilePath, optional ?? true, reloadOnChange ?? false));