summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-09-22 11:25:42 +0200
committeranonym <anonym@riseup.net>2016-09-22 14:10:24 +0200
commitc74d8929681f1e6555d8c54ad9831b725e5fea47 (patch)
tree5ccce9e618176ee94b36521aa36d51b981398b35
parent373f24e64b52aea6ad9dc5caeb9073e728abec2f (diff)
downloadonionshare-c74d8929681f1e6555d8c54ad9831b725e5fea47.tar.gz
onionshare-c74d8929681f1e6555d8c54ad9831b725e5fea47.zip
Try to get the Tor ControlPort from the environment.
... via the TOR_CONTROL_PORT variable. If set, onionshare will only try this port.
-rw-r--r--onionshare/onion.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/onionshare/onion.py b/onionshare/onion.py
index 5370fe2d..2bfd4888 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -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)