Revize 58cf6a6f
Přidáno uživatelem Pultak před asi 3 roky(ů)
ld_client/LDClient/appsettings.json | ||
---|---|---|
12 | 12 |
"LogArchiveMaxCount": 10, |
13 | 13 |
"LogCleanupPeriod": 10, |
14 | 14 |
"LogVerbosityType": 2, |
15 |
"LogFlowType": 1 |
|
16 |
} |
|
15 |
"LogFlowType": 0 |
|
16 |
}, |
|
17 |
|
|
18 |
"Network": { |
|
19 |
"ApiBaseAddress": "http://192.168.0.22", |
|
20 |
"ApiLDEndPoint": "/lauterbach-debugger-logs/", |
|
21 |
"ApiPort": 8000, |
|
22 |
"ApiRetryPeriod": 1, |
|
23 |
|
|
24 |
"DebuggerAddress": "localhost", |
|
25 |
"DebuggerPort": 20000 |
|
26 |
} |
|
17 | 27 |
} |
ld_client/LDClient/utils/ConfigLoader.cs | ||
---|---|---|
4 | 4 |
namespace LDClient.utils { |
5 | 5 |
internal class ConfigLoader { |
6 | 6 |
private const string LoggingSection = "Logging"; |
7 |
private const string NetworkSection = "Network"; |
|
7 | 8 |
|
8 | 9 |
|
9 | 10 |
public int LogChunkSize { get; set; } |
... | ... | |
16 | 17 |
|
17 | 18 |
public LogFlow LogFlowType { get; set; } = LogFlow.Console; |
18 | 19 |
|
20 |
public string ApiBaseAddress { get; set; } |
|
21 |
public string ApiUsbEndPoint { get; set; } |
|
22 |
public uint ApiPort { get; set; } |
|
23 |
public uint ApiRetryPeriod { get; set; } |
|
24 |
|
|
25 |
public string DebuggerAddress { get; set; } |
|
26 |
public int DebuggerPort { get; set; } |
|
27 |
|
|
19 | 28 |
public ConfigLoader() { |
20 | 29 |
var configuration = new ConfigurationBuilder() |
21 | 30 |
.AddJsonFile("appsettings.json") |
... | ... | |
34 | 43 |
LogCleanupPeriod = int.Parse(logging["LogCleanupPeriod"]); |
35 | 44 |
LogFlowType = (LogFlow)int.Parse(logging["LogFlowType"]); |
36 | 45 |
LogVerbosityType = (LogVerbosity)int.Parse(logging["LogVerbosityType"]); |
46 |
|
|
47 |
var network = configuration.GetSection(NetworkSection); |
|
48 |
ApiBaseAddress = network["ApiBaseAddress"]; |
|
49 |
ApiUsbEndPoint = network["ApiLDEndPoint"]; |
|
50 |
ApiPort = uint.Parse(network["ApiPort"]); |
|
51 |
ApiRetryPeriod = uint.Parse(network["ApiRetryPeriod"]); |
|
52 |
|
|
37 | 53 |
|
54 |
DebuggerAddress = network["DebuggerAddress"]; |
|
55 |
DebuggerPort = int.Parse(network["DebuggerPort"]); |
|
38 | 56 |
|
39 | 57 |
Console.WriteLine("Configuration successfully loaded!"); |
40 | 58 |
} catch (FormatException e) { |
Také k dispozici: Unified diff
re #9438 Added api configuration values