Merge branch 'refactor/groupbyhostname'
This commit is contained in:
@@ -61,6 +61,7 @@ services:
|
|||||||
VIRTUAL_NETWORK: nginx-proxy
|
VIRTUAL_NETWORK: nginx-proxy
|
||||||
VIRTUAL_PORT: 49392
|
VIRTUAL_PORT: 49392
|
||||||
VIRTUAL_HOST: ${BTCPAY_HOST}
|
VIRTUAL_HOST: ${BTCPAY_HOST}
|
||||||
|
VIRTUAL_HOST_NAME: "btcpay"
|
||||||
SSL_POLICY: Mozilla-Modern
|
SSL_POLICY: Mozilla-Modern
|
||||||
LETSENCRYPT_HOST: ${BTCPAY_HOST}
|
LETSENCRYPT_HOST: ${BTCPAY_HOST}
|
||||||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
|
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ services:
|
|||||||
VIRTUAL_NETWORK: nginx-proxy
|
VIRTUAL_NETWORK: nginx-proxy
|
||||||
VIRTUAL_PORT: 49392
|
VIRTUAL_PORT: 49392
|
||||||
VIRTUAL_HOST: ${BTCPAY_HOST}
|
VIRTUAL_HOST: ${BTCPAY_HOST}
|
||||||
|
VIRTUAL_HOST_NAME: "btcpay"
|
||||||
SSL_POLICY: Mozilla-Modern
|
SSL_POLICY: Mozilla-Modern
|
||||||
LETSENCRYPT_HOST: ${BTCPAY_HOST}
|
LETSENCRYPT_HOST: ${BTCPAY_HOST}
|
||||||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
|
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ services:
|
|||||||
VIRTUAL_NETWORK: nginx-proxy
|
VIRTUAL_NETWORK: nginx-proxy
|
||||||
VIRTUAL_PORT: 49392
|
VIRTUAL_PORT: 49392
|
||||||
VIRTUAL_HOST: ${BTCPAY_HOST}
|
VIRTUAL_HOST: ${BTCPAY_HOST}
|
||||||
|
VIRTUAL_HOST_NAME: "btcpay"
|
||||||
SSL_POLICY: Mozilla-Modern
|
SSL_POLICY: Mozilla-Modern
|
||||||
LETSENCRYPT_HOST: ${BTCPAY_HOST}
|
LETSENCRYPT_HOST: ${BTCPAY_HOST}
|
||||||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
|
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
|
||||||
|
|||||||
@@ -183,13 +183,11 @@ server {
|
|||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
{{ range $host_name, $containers := groupByMulti $ "Env.VIRTUAL_HOST_NAME" "," }}
|
||||||
|
|
||||||
{{ $host := trim $host }}
|
{{ $host_name := trim $host_name }}
|
||||||
{{ $is_regexp := hasPrefix "~" $host }}
|
{{ $upstream_name := $host_name }}
|
||||||
{{ $upstream_name := when $is_regexp (sha1 $host) $host }}
|
|
||||||
|
|
||||||
# {{ $host }}
|
|
||||||
upstream {{ $upstream_name }} {
|
upstream {{ $upstream_name }} {
|
||||||
|
|
||||||
{{ range $container := $containers }}
|
{{ range $container := $containers }}
|
||||||
@@ -218,15 +216,14 @@ upstream {{ $upstream_name }} {
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
}
|
}
|
||||||
|
{{ range $host, $containers := groupByMulti $containers "Env.VIRTUAL_HOST" "," }}
|
||||||
|
{{ $host := trim $host }}
|
||||||
{{ $default_host := or ($.Env.DEFAULT_HOST) "" }}
|
{{ $default_host := or ($.Env.DEFAULT_HOST) "" }}
|
||||||
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
|
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
|
||||||
|
|
||||||
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
|
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
|
||||||
{{ $proto := trim (or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }}
|
{{ $proto := trim (or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }}
|
||||||
|
|
||||||
{{ $host_name := trim (or (first (groupByKeys $containers "Env.VIRTUAL_HOST_NAME")) "") }}
|
|
||||||
|
|
||||||
{{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}}
|
{{/* Get the NETWORK_ACCESS defined by containers w/ the same vhost, falling back to "external" */}}
|
||||||
{{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }}
|
{{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }}
|
||||||
|
|
||||||
@@ -430,3 +427,4 @@ server {
|
|||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
Reference in New Issue
Block a user