mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-01 18:56:40 +00:00
issue #36 - env variables: .env works from anywhere on the system using absolute path fixed the issue
This commit is contained in:
parent
acad0af3a1
commit
5a7d14c16a
3 changed files with 32 additions and 18 deletions
|
@ -9,14 +9,18 @@ import time
|
|||
import urllib
|
||||
import sys
|
||||
|
||||
if os.path.exists('.env'):
|
||||
load_dotenv(".env")
|
||||
|
||||
script_abs_path = os.path.dirname(os.path.abspath(__file__))
|
||||
env_path = os.path.join(script_abs_path+"/.env")
|
||||
default_env_path = os.path.join(script_abs_path+"/.env.sample")
|
||||
|
||||
if os.path.exists(env_path):
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
else:
|
||||
load_dotenv(".env.sample")
|
||||
|
||||
tor_host = os.environ.get("TOR_HOST")
|
||||
tor_port = os.environ.get("TOR_PORT")
|
||||
load_dotenv(dotenv_path=default_env_path)
|
||||
|
||||
tor_host = os.getenv("TOR_HOST")
|
||||
tor_port = os.getenv("TOR_PORT")
|
||||
|
||||
def main():
|
||||
#os.system('clear')
|
||||
|
@ -1199,4 +1203,4 @@ Maintenance:
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue