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