Merge branch 'fred-a-kemp-feature/tor-control-port-from-env'

This commit is contained in:
Micah Lee 2016-09-27 14:09:39 -07:00
commit d8b0a4e152
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -57,7 +57,11 @@ class Onion(object):
# connect to the tor controlport
found_tor = False
self.c = None
ports = [9151, 9153, 9051]
env_port = os.environ.get('TOR_CONTROL_PORT')
if env_port:
ports = [int(env_port)]
else:
ports = [9151, 9153, 9051]
for port in ports:
try:
self.c = Controller.from_port(port=port)