switch to json crypto definitions (#246)
This commit is contained in:
committed by
Nicolas Dorier
parent
f06964cc99
commit
4280822ecf
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user