Added better support for environment variables
This commit is contained in:
parent
a2c42c01d0
commit
a4548a72c1
1 changed files with 13 additions and 7 deletions
|
|
@ -47,15 +47,21 @@ namespace LightReflectiveMirror
|
||||||
conf = JsonConvert.DeserializeObject<Config>(File.ReadAllText(CONFIG_PATH));
|
conf = JsonConvert.DeserializeObject<Config>(File.ReadAllText(CONFIG_PATH));
|
||||||
|
|
||||||
// Docker variables.
|
// Docker variables.
|
||||||
try
|
if (ushort.TryParse(Environment.GetEnvironmentVariable("LRM_ENDPOINT_PORT"), out ushort endpointPort))
|
||||||
|
conf.EndpointPort = endpointPort;
|
||||||
|
|
||||||
|
if (ushort.TryParse(Environment.GetEnvironmentVariable("LRM_TRANSPORT_PORT"), out ushort transportPort))
|
||||||
|
conf.TransportPort = transportPort;
|
||||||
|
|
||||||
|
if (ushort.TryParse(Environment.GetEnvironmentVariable("LRM_PUNCHER_PORT"), out ushort puncherPort))
|
||||||
|
conf.NATPunchtroughPort = puncherPort;
|
||||||
|
|
||||||
|
string LBAuthKey = Environment.GetEnvironmentVariable("LRM_LB_AUTHKEY");
|
||||||
|
if (!string.IsNullOrWhiteSpace(LBAuthKey))
|
||||||
{
|
{
|
||||||
conf.EndpointPort = ushort.Parse(Environment.GetEnvironmentVariable("LRM_ENDPOINT_PORT"));
|
conf.LoadBalancerAuthKey = LBAuthKey;
|
||||||
|
WriteLogMessage("\nLoaded LB auth key from environment variable\n", ConsoleColor.Green);
|
||||||
conf.TransportPort = ushort.Parse(Environment.GetEnvironmentVariable("LRM_TRANSPORT_PORT"));
|
|
||||||
|
|
||||||
conf.NATPunchtroughPort = ushort.Parse(Environment.GetEnvironmentVariable("LRM_PUNCHER_PORT"));
|
|
||||||
}
|
}
|
||||||
catch { }
|
|
||||||
|
|
||||||
WriteLogMessage("Loading Assembly... ", ConsoleColor.White, true);
|
WriteLogMessage("Loading Assembly... ", ConsoleColor.White, true);
|
||||||
try
|
try
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue