mirror of
https://github.com/oliverbooth/VPLink
synced 2024-11-10 05:15:43 +00:00
Oliver Booth
d442e4e9b3
Configuration models are now defined and generated by the ConfigurationService which makes reading config a much cleaner process.
38 lines
1.1 KiB
C#
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>()!;
|
|
}
|
|
}
|