mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 12:16:57 +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
|
@ -5,12 +5,16 @@ import json
|
|||
import random
|
||||
import os
|
||||
|
||||
if os.path.exists('.env'):
|
||||
load_dotenv(".env")
|
||||
else:
|
||||
load_dotenv(".env.sample")
|
||||
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")
|
||||
|
||||
websocket_port = os.environ.get("WEBSOCKET_PORT")
|
||||
if os.path.exists(env_path):
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
else:
|
||||
load_dotenv(dotenv_path=default_env_path)
|
||||
|
||||
websocket_port = os.getenv("WEBSOCKET_PORT")
|
||||
|
||||
|
||||
def is_simplex_link_valid(simplex_link: str) -> bool:
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -7,13 +7,19 @@ import json
|
|||
import pandas as pd
|
||||
import glob
|
||||
|
||||
if os.path.exists('.env'):
|
||||
load_dotenv(".env")
|
||||
else:
|
||||
load_dotenv(".env.sample")
|
||||
|
||||
tor_host = os.environ.get("TOR_HOST")
|
||||
tor_port = os.environ.get("TOR_PORT")
|
||||
|
||||
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(dotenv_path=default_env_path)
|
||||
|
||||
tor_host = os.getenv("TOR_HOST")
|
||||
tor_port = os.getenv("TOR_PORT")
|
||||
|
||||
#apt install python3-pandas python3-requests python3-socks
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue