Setting control methods through environment variables
Hey buddy!
I was trying out the new v2.2 and was surprised that it couldn't communicate with my Tor daemon right away. Turns out I merely had an outdated password saved, yet this led me to realize a few other things.
As mentioned, I run Tor persistently as a system service on both Linux and Win32, even with Tor Browser Bundle. How? The TOR_CONTROL_PASSWD environment variable. Which I must note needs to contain regular quotes inside of single quotations surrounding the password string (to work with TBB).
I strongly suggest that you load TOR_CONTROL_PASSWD from the environment if there'ś no setting saved. For completenes sake this means TOR_CONTROL_HOST and TOR_CONTROL_PORT as well.
Secondly, it's not clear to me how cookie authentication is able to work with an external Tor. Can you add a setting for a cookie path, defaulting to /run/tor/control.authcookie (aka TOR_CONTROL_COOKIE_AUTH_FILE)?
Source: onionshare/onionshare