about summary refs log tree commit diff
path: root/ModerationClient/Services/ModerationClientConfiguration.cs
blob: f770fef89707fd550c03c661df70a8c3a83e5963 (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
27
28
29
30
31
using System;
using System.Collections;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using ArcaneLibs;
using ArcaneLibs.Extensions;
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; }
}