Add ability to take the fake relay api key from env variable

This commit is contained in:
Gervasio Marchand 2022-12-07 20:28:31 -03:00
parent f757ce4818
commit 082d261116
No known key found for this signature in database
GPG Key ID: B7736CB188DD0A38

View File

@ -33,14 +33,15 @@ public class Config
var data = JSON.Deserialize<ConfigData>(File.ReadAllText(path));
var importedPath = Path.Join(Path.GetDirectoryName(path), "imported.txt");
var apiKey = data.FakeRelayApiKey ?? Environment.GetEnvironmentVariable("FAKERELAY_APIKEY");
Instance = new Config(importedPath, data.FakeRelayUrl, data.FakeRelayApiKey, data.Tags.ToImmutableArray(), data.ImmutableSites);
Instance = new Config(importedPath, data.FakeRelayUrl, apiKey, data.Tags.ToImmutableArray(), data.ImmutableSites);
}
private class ConfigData
{
public string FakeRelayUrl { get; set; }
public string FakeRelayApiKey { get; set; }
public string? FakeRelayApiKey { get; set; }
public string[] Tags { get; set; }
public InternalSiteData[]? Sites { get; set; }