nicolas.dorier
7 years ago
8 changed files with 173 additions and 80 deletions
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace DockerGenerator |
|||
{ |
|||
public class CryptoDefinition |
|||
{ |
|||
public string Crypto |
|||
{ |
|||
get; |
|||
private set; |
|||
} |
|||
public string CryptoFragment |
|||
{ |
|||
get; |
|||
private set; |
|||
} |
|||
public string CLightningFragment |
|||
{ |
|||
get; |
|||
private set; |
|||
} |
|||
|
|||
public static CryptoDefinition[] GetDefinitions() |
|||
{ |
|||
return new[] |
|||
{ |
|||
new CryptoDefinition() |
|||
{ |
|||
Crypto = "ltc", |
|||
CryptoFragment = "litecoin", |
|||
CLightningFragment = "litecoin-clightning", |
|||
}, |
|||
new CryptoDefinition() |
|||
{ |
|||
Crypto = "btc", |
|||
CryptoFragment = "bitcoin", |
|||
CLightningFragment = "bitcoin-clightning", |
|||
}, |
|||
}; |
|||
} |
|||
} |
|||
} |
@ -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; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
{ |
|||
"profiles": { |
|||
"docker-compose-generator": { |
|||
"commandName": "Project", |
|||
"commandLineArgs": "pregen", |
|||
"environmentVariables": { |
|||
"BTCPAYGEN_LIGHTNING": "clightning", |
|||
"BTCPAYGEN_CRYPTO2": "ltc", |
|||
"BTCPAYGEN_CRYPTO1": "btc", |
|||
"BTCPAYGEN_REVERSEPROXY": "nginx" |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,4 +1,4 @@ |
|||
# This script will run docker-compose-generator in a container to generate the yml files |
|||
|
|||
docker build -t btcpayserver/docker-compose-generator "$(Get-Location)\docker-compose-generator" |
|||
docker run -v "$(Get-Location)\Production:/app/Production" -v "$(Get-Location)\Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm btcpayserver/docker-compose-generator |
|||
docker run -v "$(Get-Location)\Production:/app/Production" -v "$(Get-Location)\Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm btcpayserver/docker-compose-generator pregen |
Loading…
Reference in new issue