Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tls label (alias of tls-email) #19

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ There are several options to configure:
- `virtual.host` is basically a domain name, see [`Caddy` docs](https://caddyserver.com/docs/proxy)
- `virtual.alias` (optional) domain alias, useful for `www` prefix with redirect. For example `www.myapp.com`. Alias will always redirect to the host above.
- `virtual.port` exposed port of the container
- `virtual.tls_email` could be empty, unset or set to [valid email](https://caddyserver.com/docs/tls)
- `virtual.tls-email` could be empty, unset or set to [valid email](https://caddyserver.com/docs/tls)
- `virtual.tls` (alias of `virtual.tls-email`) could be empty, unset or set to a [valid set of tls directive value(s)](https://caddyserver.com/docs/tls)
- `virtual.websocket` when set, enables websocket connection passthrough

Note, that options should not differ for containers of a single service.
Expand Down
6 changes: 4 additions & 2 deletions docker-gen/templates/Caddyfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ errors stderr
{{ $c := first $containers }}
{{ $allhosts := trim (index $c.Labels "virtual.host") }}
{{ range $t, $host := split $allhosts " " }}
{{ $tlsEnv := trim (index $c.Labels "virtual.tls-email") }}
{{ $tlsEmail := trim (index $c.Labels "virtual.tls-email") }}
{{ $tlsConfig := trim (index $c.Labels "virtual.tls") }}
{{ $tlsEnv := or $tlsEmail $tlsConfig }}
{{ $tlsOff := eq $tlsEnv "" }}
{{ $alias := trim (index $c.Labels "virtual.alias") }}
{{ $aliasPresent := ne $alias "" }}
Expand All @@ -30,7 +32,7 @@ errors stderr
policy round_robin
transparent
{{ if contains $c.Labels "virtual.websockets" }}websocket{{ end }}

{{ range $i, $container := $containers }}
{{ range $j, $net := $container.Networks }}
{{ $port := index $container.Labels "virtual.port" }}
Expand Down