Browse Source
Merge pull request #123 from Kukks/feature/exclude-fragments
Introduce Exclude Fragments option
feature/more-args
Nicolas Dorier
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
18 additions and
1 deletions
README.md
btcpay-setup.sh
build.ps1
build.sh
docker-compose-generator/src/DockerComposition.cs
docker-compose-generator/src/Program.cs
@ -129,6 +129,7 @@ You can read [the article](https://medium.com/@BtcpayServer/hosting-btcpay-serve
* `BTCPAY_SSHTRUSTEDFINGERPRINTS` : Optional, BTCPay will ensure that it is connecting to the expected SSH server by checking the host's public key against these fingerprints
* `BTCPAYGEN_DOCKER_IMAGE` : Optional, Specify which generator image to use if you have customized the C# generator. Set to `btcpayserver/docker-compose-generator:local` to build the generator locally at runtime.
* `BTCPAY_IMAGE` : Optional, Specify which btcpayserver image to use if you have a customized btcpayserver.
* `BTCPAYGEN_EXCLUDE_FRAGMENTS` : Semicolon-separated list of fragments you want to forcefully exclude(eg. `litecoin-clightning` )
Additionally, there are specific environment variables for some addons:
@ -66,6 +66,7 @@ Environment variables:
Add-on specific variables:
LIBREPATRON_HOST: If libre patron is activated with opt-add-librepatron, the hostname of your libre patron website ( eg. librepatron.example.com)
WOOCOMMERCE_HOST: If woocommerce is activated with opt-add-woocommerce, the hostname of your woocommerce website ( eg. store.example.com)
BTCPAYGEN_EXCLUDE_FRAGMENTS: Semicolon-separated list of fragments you want to forcefully exclude( eg. litecoin-clightning)
END
}
@ -161,6 +162,7 @@ BTCPAYGEN_CRYPTO9:$BTCPAYGEN_CRYPTO9
BTCPAYGEN_REVERSEPROXY:$BTCPAYGEN_REVERSEPROXY
BTCPAYGEN_LIGHTNING:$BTCPAYGEN_LIGHTNING
BTCPAYGEN_ADDITIONAL_FRAGMENTS:$BTCPAYGEN_ADDITIONAL_FRAGMENTS
BTCPAYGEN_EXCLUDE_FRAGMENTS:$BTCPAYGEN_EXCLUDE_FRAGMENTS
BTCPAY_IMAGE:$BTCPAY_IMAGE
ACME_CA_URI:$ACME_CA_URI
----------------------
@ -200,6 +202,7 @@ export BTCPAYGEN_CRYPTO9=\"$BTCPAYGEN_CRYPTO9\"
export BTCPAYGEN_LIGHTNING = \" $BTCPAYGEN_LIGHTNING \"
export BTCPAYGEN_REVERSEPROXY = \" $BTCPAYGEN_REVERSEPROXY \"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS = \" $BTCPAYGEN_ADDITIONAL_FRAGMENTS \"
export BTCPAYGEN_EXCLUDE_FRAGMENTS = \" $BTCPAYGEN_EXCLUDE_FRAGMENTS \"
export BTCPAY_DOCKER_COMPOSE = \" $BTCPAY_DOCKER_COMPOSE \"
export BTCPAY_BASE_DIRECTORY = \" $BTCPAY_BASE_DIRECTORY \"
export BTCPAY_ENV_FILE = \" $BTCPAY_ENV_FILE \"
@ -21,6 +21,7 @@ docker run -v "$(Get-Location)\Generated:/app/Generated" `
-e " BTCPAYGEN_CRYPTO9= $ BTCPAYGEN_CRYPTO9 " `
-e " BTCPAYGEN_REVERSEPROXY= $ BTCPAYGEN_REVERSEPROXY " `
-e " BTCPAYGEN_ADDITIONAL_FRAGMENTS= $ BTCPAYGEN_ADDITIONAL_FRAGMENTS " `
-e " BTCPAYGEN_EXCLUDE_FRAGMENTS= $ BTCPAYGEN_EXCLUDE_FRAGMENTS " `
-e " BTCPAYGEN_LIGHTNING= $ BTCPAYGEN_LIGHTNING " `
-e " BTCPAYGEN_SUBNAME= $ BTCPAYGEN_SUBNAME " `
- -rm $BTCPAYGEN_DOCKER_IMAGE
@ -22,6 +22,7 @@ docker run -v "$(pwd)/Generated:/app/Generated" \
-e " BTCPAYGEN_CRYPTO9= $BTCPAYGEN_CRYPTO9 " \
-e " BTCPAYGEN_REVERSEPROXY= $BTCPAYGEN_REVERSEPROXY " \
-e " BTCPAYGEN_ADDITIONAL_FRAGMENTS= $BTCPAYGEN_ADDITIONAL_FRAGMENTS " \
-e " BTCPAYGEN_EXCLUDE_FRAGMENTS= $BTCPAYGEN_EXCLUDE_FRAGMENTS " \
-e " BTCPAYGEN_LIGHTNING= $BTCPAYGEN_LIGHTNING " \
-e " BTCPAYGEN_SUBNAME= $BTCPAYGEN_SUBNAME " \
--rm $BTCPAYGEN_DOCKER_IMAGE
@ -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 ;