Merge pull request #1 from Kjwon15/for-dokku

Add dokku-alt support
This commit is contained in:
Christophe Mehay 2016-01-19 22:03:27 +01:00
commit 7f16f43cdf

View File

@ -11,8 +11,9 @@ def set_conf():
with open("/etc/tor/torrc", "a") as conf:
for link in links:
path = "/var/lib/tor/hidden_service/{service}".format(service=link)
env_port = links[link]['environment'].get('PORT')
# Test if link has ports
if len(links[link]['ports']) == 0:
if len(links[link]['ports']) == 0 and not env_port:
print("{link} has no port")
continue
conf.write('HiddenServiceDir {path}\n'.format(path=path))
@ -26,6 +27,13 @@ def set_conf():
conf.write('HiddenServicePort {service}\n'.format(
service=service
))
if env_port:
service = '80 {ip}:{port}'.format(
port=env_port, ip=links[link]['ip']
)
conf.write('HiddenServicePort {service}\n'.format(
service=service
))
# set relay if enabled in env (not so secure)
if 'RELAY' in os.environ:
conf.write("ORPort 9001\n")