using Lumina.Presentation.Web.Common.Models.Configuration;
using Lumina.Presentation.Web.Common.Utilities;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Lumina.Presentation.Web.Common.DependencyInjection;
///
/// Class containing the configuration bindings of the Lumina.Presentation.Web project.
///
internal static class PresentationWebLayerConfiguration
{
#region ===================================================================== METHODS ===================================================================================
///
/// Extension method for registering the configuration options of the Lumina.Presentation.Web project into the Dependency Injection container.
///
/// The to bind the configuration options to.
/// The configuration to be bound.
/// The updated .
internal static IServiceCollection BindConfiguration(this IServiceCollection serviceCollection, IConfigurationManager configuration)
{
// add the configuration sources to the configuration builder
configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
configuration.AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true);
serviceCollection.AddOptions()
.Bind(configuration.GetRequiredSection(ServerConfigurationModel.SECTION_NAME))
.ValidateFluently()
.ValidateOnStart();
return serviceCollection;
}
#endregion
}