mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue