mirror of
https://github.com/aljazceru/btcpayserver-docker.git
synced 2025-12-18 10:24:22 +01:00
Merge pull request #123 from Kukks/feature/exclude-fragments
Introduce Exclude Fragments option
This commit is contained in:
@@ -27,6 +27,11 @@ namespace DockerGenerator
|
||||
get;
|
||||
set;
|
||||
} = new string[0];
|
||||
public string[] ExcludeFragments
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new string[0];
|
||||
|
||||
public static DockerComposition FromEnvironmentVariables()
|
||||
{
|
||||
@@ -46,6 +51,11 @@ namespace DockerGenerator
|
||||
.Where(t => !string.IsNullOrWhiteSpace(t))
|
||||
.Select(t => t.EndsWith(".yml") ? t.Substring(0, t.Length - ".yml".Length) : t)
|
||||
.ToArray();
|
||||
composition.ExcludeFragments = (Environment.GetEnvironmentVariable("BTCPAYGEN_EXCLUDE_FRAGMENTS") ?? "").ToLowerInvariant()
|
||||
.Split(new char[] { ';' , ',' })
|
||||
.Where(t => !string.IsNullOrWhiteSpace(t))
|
||||
.Select(t => t.EndsWith(".yml") ? t.Substring(0, t.Length - ".yml".Length) : t)
|
||||
.ToArray();
|
||||
return composition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -72,6 +72,7 @@ namespace DockerGenerator
|
||||
{
|
||||
fragments.Add(fragment.Trim());
|
||||
}
|
||||
fragments = fragments.Where(s => !composition.ExcludeFragments.Contains(s)).ToHashSet();
|
||||
var def = new DockerComposeDefinition(name, fragments.ToList());
|
||||
def.FragmentLocation = fragmentLocation;
|
||||
def.BuildOutputDirectory = output;
|
||||
|
||||
Reference in New Issue
Block a user