mirror of
https://github.com/aljazceru/btcpayserver-docker.git
synced 2025-12-19 15:24:20 +01:00
Refactor docker-compose-generator so that generation can be dynamic
This commit is contained in:
41
docker-compose-generator/src/DockerComposition.cs
Normal file
41
docker-compose-generator/src/DockerComposition.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace DockerGenerator
|
||||
{
|
||||
public class DockerComposition
|
||||
{
|
||||
public HashSet<string> SelectedCryptos
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string SelectedProxy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string SelectedLN
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static DockerComposition FromEnvironmentVariables()
|
||||
{
|
||||
DockerComposition composition = new DockerComposition();
|
||||
composition.SelectedCryptos = new HashSet<string>();
|
||||
for(int i = 1; i < 10; i++)
|
||||
{
|
||||
var selectedCrypto = Environment.GetEnvironmentVariable("BTCPAYGEN_CRYPTO" + i);
|
||||
if(string.IsNullOrEmpty(selectedCrypto))
|
||||
break;
|
||||
composition.SelectedCryptos.Add(selectedCrypto.ToLowerInvariant());
|
||||
}
|
||||
composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant();
|
||||
composition.SelectedLN = (Environment.GetEnvironmentVariable("BTCPAYGEN_LIGHTNING") ?? "").ToLowerInvariant();
|
||||
return composition;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user