about summary refs log tree commit diff
path: root/ModerationClient/Services/ModerationClientConfiguration.cs
blob: 3cc4ffbc851e2c31c2be70505dab04982232e6b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Diagnostics.CodeAnalysis;
using ArcaneLibs;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace MatrixUtils.Desktop;

public class ModerationClientConfiguration
{
    private ILogger<ModerationClientConfiguration> _logger;

    [RequiresUnreferencedCode("Uses reflection binding")]
    public ModerationClientConfiguration(ILogger<ModerationClientConfiguration> logger, IConfiguration config, HostBuilderContext host)
    {
        _logger = logger;
        logger.LogInformation("Loading configuration for environment: {}...", host.HostingEnvironment.EnvironmentName);
        config.GetSection("ModerationClient").Bind(this);
        DataStoragePath = Util.ExpandPath(DataStoragePath);
        CacheStoragePath = Util.ExpandPath(CacheStoragePath);
    }

    public string? DataStoragePath { get; set; } = "";
    public string? CacheStoragePath { get; set; } = "";
    public string? SentryDsn { get; set; }
}