mirror of
https://github.com/aljazceru/btcpayserver-docker.git
synced 2025-12-18 17:34:19 +01:00
Show proper error message if using incompatible options
This commit is contained in:
@@ -54,6 +54,7 @@ namespace DockerGenerator
|
|||||||
var volumes = new List<KeyValuePair<YamlNode, YamlNode>>();
|
var volumes = new List<KeyValuePair<YamlNode, YamlNode>>();
|
||||||
var networks = new List<KeyValuePair<YamlNode, YamlNode>>();
|
var networks = new List<KeyValuePair<YamlNode, YamlNode>>();
|
||||||
var exclusives = new List<(FragmentName FragmentName, string Exclusivity)>();
|
var exclusives = new List<(FragmentName FragmentName, string Exclusivity)>();
|
||||||
|
var incompatibles = new List<(FragmentName FragmentName, string Exclusivity)>();
|
||||||
|
|
||||||
foreach (var fragment in Fragments.Where(NotExcluded))
|
foreach (var fragment in Fragments.Where(NotExcluded))
|
||||||
{
|
{
|
||||||
@@ -92,6 +93,13 @@ namespace DockerGenerator
|
|||||||
exclusives.Add((fragment, node.ToString()));
|
exclusives.Add((fragment, node.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (doc.Children.ContainsKey("incompatible") && doc.Children["incompatible"] is YamlSequenceNode fragmentIncompatibleRoot)
|
||||||
|
{
|
||||||
|
foreach (var node in fragmentIncompatibleRoot)
|
||||||
|
{
|
||||||
|
incompatibles.Add((fragment, node.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (doc.Children.ContainsKey("required") && doc.Children["required"] is YamlSequenceNode fragmentRequireRoot)
|
if (doc.Children.ContainsKey("required") && doc.Children["required"] is YamlSequenceNode fragmentRequireRoot)
|
||||||
{
|
{
|
||||||
foreach (var node in fragmentRequireRoot)
|
foreach (var node in fragmentRequireRoot)
|
||||||
@@ -126,6 +134,14 @@ namespace DockerGenerator
|
|||||||
if (exclusiveConflict != null)
|
if (exclusiveConflict != null)
|
||||||
throw new YamlBuildException($"The fragments {String.Join(", ", exclusiveConflict.Select(e => e.FragmentName))} can't be used simultaneously (group '{exclusiveConflict.Key}')");
|
throw new YamlBuildException($"The fragments {String.Join(", ", exclusiveConflict.Select(e => e.FragmentName))} can't be used simultaneously (group '{exclusiveConflict.Key}')");
|
||||||
|
|
||||||
|
var groups = exclusives.ToDictionary(e => e.Exclusivity, e => e.FragmentName);
|
||||||
|
var incompatible = incompatibles
|
||||||
|
.Select(i => groups.TryGetValue(i.Exclusivity, out _) ? (i.FragmentName, i.Exclusivity) : (null, null))
|
||||||
|
.Where(i => i.Exclusivity != null)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (incompatible.Exclusivity != null)
|
||||||
|
throw new YamlBuildException($"The fragment {incompatible.FragmentName} is incompatible with '{incompatible.Exclusivity}'");
|
||||||
|
|
||||||
Console.WriteLine($"Selected fragments:");
|
Console.WriteLine($"Selected fragments:");
|
||||||
foreach (var fragment in processedFragments)
|
foreach (var fragment in processedFragments)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
"BTCPAYGEN_CRYPTO2": "ltc",
|
"BTCPAYGEN_CRYPTO2": "ltc",
|
||||||
"BTCPAYGEN_CRYPTO1": "btc",
|
"BTCPAYGEN_CRYPTO1": "btc",
|
||||||
"BTCPAYGEN_REVERSEPROXY": "nginx",
|
"BTCPAYGEN_REVERSEPROXY": "nginx",
|
||||||
"BTCPAYGEN_ADDITIONAL_FRAGMENTS": "opt-save-storage",
|
"BTCPAYGEN_ADDITIONAL_FRAGMENTS": "opt-save-storage;opt-txindex"
|
||||||
"BTCPAYGEN_EXCLUDE_FRAGMENTS": "postgres"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user