Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 58cf6a6f

Přidáno uživatelem Pultak před asi 2 roky(ů)

re #9438 Added api configuration values

Zobrazit rozdíly:

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