mirror of
https://github.com/Retropex/btcpayserver-docker.git
synced 2025-05-12 21:10:42 +02:00
switch to json crypto definitions (#246)
This commit is contained in:
parent
f06964cc99
commit
4280822ecf
@ -10,6 +10,7 @@ If ($BTCPAYGEN_DOCKER_IMAGE -eq "btcpayserver/docker-compose-generator:local"){
|
||||
|
||||
docker run -v "$(Get-Location)\Generated:/app/Generated" `
|
||||
-v "$(Get-Location)\docker-compose-generator\docker-fragments:/app/docker-fragments" `
|
||||
-v "$(Get-Location)\docker-compose-generator\crypto-definitions.json:/app/crypto-definitions.json" `
|
||||
-e "BTCPAYGEN_CRYPTO1=$BTCPAYGEN_CRYPTO1" `
|
||||
-e "BTCPAYGEN_CRYPTO2=$BTCPAYGEN_CRYPTO2" `
|
||||
-e "BTCPAYGEN_CRYPTO3=$BTCPAYGEN_CRYPTO3" `
|
||||
|
1
build.sh
1
build.sh
@ -16,6 +16,7 @@ fi
|
||||
# This script will run docker-compose-generator in a container to generate the yml files
|
||||
docker run -v "$(pwd)/Generated:/app/Generated" \
|
||||
-v "$(pwd)/docker-compose-generator/docker-fragments:/app/docker-fragments" \
|
||||
-v "$(pwd)/docker-compose-generator/crypto-definitions.json:/app/crypto-definitions.json" \
|
||||
-e "BTCPAYGEN_CRYPTO1=$BTCPAYGEN_CRYPTO1" \
|
||||
-e "BTCPAYGEN_CRYPTO2=$BTCPAYGEN_CRYPTO2" \
|
||||
-e "BTCPAYGEN_CRYPTO3=$BTCPAYGEN_CRYPTO3" \
|
||||
|
86
docker-compose-generator/crypto-definitions.json
Normal file
86
docker-compose-generator/crypto-definitions.json
Normal file
@ -0,0 +1,86 @@
|
||||
[
|
||||
{
|
||||
"Crypto": "ltc",
|
||||
"CryptoFragment": "litecoin",
|
||||
"CLightningFragment": "litecoin-clightning",
|
||||
"LNDFragment": "litecoin-lnd",
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "btc",
|
||||
"CryptoFragment": "bitcoin",
|
||||
"CLightningFragment": "bitcoin-clightning",
|
||||
"LNDFragment": "bitcoin-lnd",
|
||||
"EclairFragment": "bitcoin-eclair"
|
||||
},
|
||||
{
|
||||
"Crypto": "btx",
|
||||
"CryptoFragment": "bitcore",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "btg",
|
||||
"CryptoFragment": "bgold",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": "bgold-lnd",
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "ftc",
|
||||
"CryptoFragment": "feathercoin",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "grs",
|
||||
"CryptoFragment": "groestlcoin",
|
||||
"CLightningFragment": "groestlcoin-clightning",
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "via",
|
||||
"CryptoFragment": "viacoin",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "dash",
|
||||
"CryptoFragment": "dash",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "doge",
|
||||
"CryptoFragment": "dogecoin",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "mona",
|
||||
"CryptoFragment": "monacoin",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "xmr",
|
||||
"CryptoFragment": "monero",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
},
|
||||
{
|
||||
"Crypto": "lbtc",
|
||||
"CryptoFragment": "liquid",
|
||||
"CLightningFragment": null,
|
||||
"LNDFragment": null,
|
||||
"EclairFragment": null
|
||||
}
|
||||
]
|
@ -1,111 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace DockerGenerator
|
||||
namespace DockerGenerator
|
||||
{
|
||||
public class CryptoDefinition
|
||||
{
|
||||
public string Crypto
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string CryptoFragment
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string CLightningFragment
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string LNDFragment
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string EclairFragment
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static CryptoDefinition[] GetDefinitions()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "ltc",
|
||||
CryptoFragment = "litecoin",
|
||||
CLightningFragment = "litecoin-clightning",
|
||||
LNDFragment = "litecoin-lnd"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "btc",
|
||||
CryptoFragment = "bitcoin",
|
||||
CLightningFragment = "bitcoin-clightning",
|
||||
LNDFragment = "bitcoin-lnd",
|
||||
EclairFragment = "bitcoin-eclair"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "btx",
|
||||
CryptoFragment = "bitcore",
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "btg",
|
||||
CryptoFragment = "bgold",
|
||||
LNDFragment = "bgold-lnd"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "ftc",
|
||||
CryptoFragment = "feathercoin"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "grs",
|
||||
CryptoFragment = "groestlcoin",
|
||||
CLightningFragment = "groestlcoin-clightning",
|
||||
LNDFragment = "groestlcoin-lnd"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "via",
|
||||
CryptoFragment = "viacoin"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "dash",
|
||||
CryptoFragment = "dash"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "doge",
|
||||
CryptoFragment = "dogecoin"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "mona",
|
||||
CryptoFragment = "monacoin"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "xmr",
|
||||
CryptoFragment = "monero"
|
||||
},
|
||||
new CryptoDefinition()
|
||||
{
|
||||
Crypto = "lbtc",
|
||||
CryptoFragment = "liquid"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
public class CryptoDefinition
|
||||
{
|
||||
public string Crypto { get; set; }
|
||||
public string CryptoFragment { get; set; }
|
||||
public string CLightningFragment { get; set; }
|
||||
public string LNDFragment { get; set; }
|
||||
public string EclairFragment { get; set; }
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace DockerGenerator
|
||||
@ -35,10 +36,12 @@ namespace DockerGenerator
|
||||
|
||||
private void Run(DockerComposition composition, string name, string output)
|
||||
{
|
||||
var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? "app" : "docker-compose-generator";
|
||||
fragmentLocation = FindRoot(fragmentLocation);
|
||||
fragmentLocation = Path.GetFullPath(Path.Combine(fragmentLocation, "docker-fragments"));
|
||||
|
||||
var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? "app" : "docker-compose-generator";
|
||||
root = FindRoot(root);
|
||||
var fragmentLocation = Path.GetFullPath(Path.Combine(root, "docker-fragments"));
|
||||
var cryptoDefinitionsLocation = Path.GetFullPath(Path.Combine(root, "crypto-definitions.json"));
|
||||
var cryptoDefinitions =
|
||||
JsonSerializer.Deserialize<CryptoDefinition[]>(File.ReadAllText(cryptoDefinitionsLocation));
|
||||
var fragments = new HashSet<string>();
|
||||
switch (composition.SelectedProxy)
|
||||
{
|
||||
@ -55,7 +58,8 @@ namespace DockerGenerator
|
||||
break;
|
||||
}
|
||||
fragments.Add("btcpayserver");
|
||||
foreach (var crypto in CryptoDefinition.GetDefinitions())
|
||||
|
||||
foreach (var crypto in cryptoDefinitions)
|
||||
{
|
||||
if (!composition.SelectedCryptos.Contains(crypto.Crypto))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user