1
0
mirror of https://github.com/oliverbooth/VPLink synced 2024-11-10 05:15:43 +00:00
VPLink/VPLink/Services/ConfigurationService.cs
Oliver Booth d442e4e9b3
refactor: clean up config reads
Configuration models are now defined and generated by the ConfigurationService which makes reading config a much cleaner process.
2023-08-26 13:21:01 +01:00

38 lines
1.1 KiB
C#

using Microsoft.Extensions.Configuration;
using VPLink.Configuration;
namespace VPLink.Services;
/// <inheritdoc cref="IConfigurationService" />
internal sealed class ConfigurationService : IConfigurationService
{
private readonly IConfiguration _configuration;
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationService" /> class.
/// </summary>
/// <param name="configuration"></param>
public ConfigurationService(IConfiguration configuration)
{
_configuration = configuration;
}
/// <inheritdoc />
public BotConfiguration BotConfiguration
{
get => _configuration.GetSection("Bot").Get<BotConfiguration>()!;
}
/// <inheritdoc />
public DiscordConfiguration DiscordConfiguration
{
get => _configuration.GetSection("Discord").Get<DiscordConfiguration>()!;
}
/// <inheritdoc />
public VirtualParadiseConfiguration VirtualParadiseConfiguration
{
get => _configuration.GetSection("VirtualParadise").Get<VirtualParadiseConfiguration>()!;
}
}