Browse Source

Make sure no hidden service dir if no hidden port

feature/more-args
nicolas.dorier 6 years ago
parent
commit
80ca5102e3
  1. 8
      Generated/torrc.tmpl

8
Generated/torrc.tmpl

@ -1,8 +1,7 @@
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }} {{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
{{ range $name, $containers := groupByMulti $ "Env.HIDDENSERVICE_NAME" "," }} {{ range $name, $containers := groupByMulti $ "Env.HIDDENSERVICE_NAME" "," }}
# For the hidden service {{ $name }} {{ $firstServicePort := true }}
HiddenServiceDir /var/lib/tor/hidden_services/{{ $name }}
{{ range $container := $containers }} {{ range $container := $containers }}
{{ range $knownNetwork := $CurrentContainer.Networks }} {{ range $knownNetwork := $CurrentContainer.Networks }}
{{ range $containerNetwork := $container.Networks }} {{ range $containerNetwork := $container.Networks }}
@ -14,6 +13,11 @@ HiddenServiceDir /var/lib/tor/hidden_services/{{ $name }}
{{ $port := coalesce $container.Env.HIDDENSERVICE_PORT "80" }} {{ $port := coalesce $container.Env.HIDDENSERVICE_PORT "80" }}
{{ $virtualPort := coalesce $container.Env.HIDDENSERVICE_VIRTUAL_PORT $port }} {{ $virtualPort := coalesce $container.Env.HIDDENSERVICE_VIRTUAL_PORT $port }}
{{ if ne $containerNetwork.IP "" }} {{ if ne $containerNetwork.IP "" }}
{{ if $firstServicePort }}
# For the hidden service {{ $name }}
HiddenServiceDir /var/lib/tor/hidden_services/{{ $name }}
{{ $firstServicePort := false }}
{{ end }}
# Redirecting to {{ $containerOrReverseProxyName }} # Redirecting to {{ $containerOrReverseProxyName }}
HiddenServicePort {{ $virtualPort }} {{ $containerNetwork.IP }}:{{ $port }} HiddenServicePort {{ $virtualPort }} {{ $containerNetwork.IP }}:{{ $port }}
{{ end }} {{ end }}

Loading…
Cancel
Save