Need to check if env file exists, otherwise it errors

This commit is contained in:
Isaac Shoebottom 2024-07-31 20:08:30 -03:00
parent c9f7ab8f92
commit 42ba2be0f8

View File

@ -18,13 +18,14 @@ if not DOWNLOAD_PATH:
DOWNLOAD_PATH = "./downloads" DOWNLOAD_PATH = "./downloads"
# Read in dot env file # Read in dot env file
file = open(".env", "r") if os.path.exists(".env"):
lines = file.readlines() file = open(".env", "r")
for line in lines: lines = file.readlines()
key, value = line.split("=") for line in lines:
key = key.strip() key, value = line.split("=")
if os.environ.get(key) is None: key = key.strip()
os.environ[key] = value.strip() if os.environ.get(key) is None:
os.environ[key] = value.strip()
# Docs: https://app.swaggerhub.com/apis-docs/NexusMods/nexus-mods_public_api_params_in_form_data/1.0 # Docs: https://app.swaggerhub.com/apis-docs/NexusMods/nexus-mods_public_api_params_in_form_data/1.0