-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.cs
31 lines (28 loc) · 1.23 KB
/
Settings.cs
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 Microsoft.Extensions.Configuration;
using System.Linq;
namespace Quras
{
internal class Settings
{
public string DataDirectoryPath { get; private set; }
public ushort NodePort { get; private set; }
public ushort WsPort { get; private set; }
public string[] UriPrefix { get; private set; }
public string SslCert { get; private set; }
public string SslCertPassword { get; private set; }
public static Settings Default { get; private set; }
static Settings()
{
IConfigurationSection section = new ConfigurationBuilder().AddJsonFile("config.json").Build().GetSection("ApplicationConfiguration");
Default = new Settings
{
DataDirectoryPath = section.GetSection("DataDirectoryPath").Value,
NodePort = ushort.Parse(section.GetSection("NodePort").Value),
WsPort = ushort.Parse(section.GetSection("WsPort").Value),
UriPrefix = section.GetSection("UriPrefix").GetChildren().Select(p => p.Value).ToArray(),
SslCert = section.GetSection("SslCert").Value,
SslCertPassword = section.GetSection("SslCertPassword").Value
};
}
}
}