mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-17 04:36: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
|
@ -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