-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfig.cs
54 lines (45 loc) · 1.46 KB
/
Config.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections;
namespace TecanSparkRelay
{
public class Config
{
public string version = "TecanSpark/v1alpha1";
public readonly ForwarderConfig forwarder;
public readonly ManagerConfig manager;
public readonly RedisPubSubConfig pubsub;
public Config()
{
IDictionary config = Environment.GetEnvironmentVariables();
this.forwarder = new ForwarderConfig(config);
this.manager = new ManagerConfig(config);
this.pubsub = new RedisPubSubConfig(config);
}
}
public class ForwarderConfig
{
public string DataGatewayURL;
public ForwarderConfig(IDictionary config)
{
this.DataGatewayURL = config["FORWARDER_DATA_GATEWAY_URL"].ToString() ?? this.DataGatewayURL;
}
}
public class ManagerConfig
{
public string DeviceName;
public string Instrument = "1910012500";
public ManagerConfig(IDictionary config)
{
this.DeviceName = config["MANAGER_DEVICE_NAME"]?.ToString() ?? this.DeviceName;
this.Instrument = config["MANAGER_INSTRUMENT"]?.ToString() ?? this.Instrument;
}
}
public class RedisPubSubConfig
{
public string URL = "redis://127.0.0.1:6389";
public RedisPubSubConfig(IDictionary config)
{
this.URL = config["REDIS_PUBSUB_URL"]?.ToString() ?? this.URL;
}
}
}