2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

do not cover secret key

This commit is contained in:
Matthias 2022-02-13 20:14:18 +01:00
parent 2bba1766b0
commit 5a40bdda51
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -119,20 +119,20 @@ d) Create "secret_key.txt" if it does not exist
if os.getenv("INVENTREE_SECRET_KEY"): if os.getenv("INVENTREE_SECRET_KEY"):
# Secret key passed in directly # Secret key passed in directly
SECRET_KEY = os.getenv("INVENTREE_SECRET_KEY").strip() SECRET_KEY = os.getenv("INVENTREE_SECRET_KEY").strip() # pragma: no cover
logger.info("SECRET_KEY loaded by INVENTREE_SECRET_KEY") logger.info("SECRET_KEY loaded by INVENTREE_SECRET_KEY") # pragma: no cover
else: else:
# Secret key passed in by file location # Secret key passed in by file location
key_file = os.getenv("INVENTREE_SECRET_KEY_FILE") key_file = os.getenv("INVENTREE_SECRET_KEY_FILE")
if key_file: if key_file:
key_file = os.path.abspath(key_file) key_file = os.path.abspath(key_file) # pragma: no cover
else: else:
# default secret key location # default secret key location
key_file = os.path.join(BASE_DIR, "secret_key.txt") key_file = os.path.join(BASE_DIR, "secret_key.txt")
key_file = os.path.abspath(key_file) key_file = os.path.abspath(key_file)
if not os.path.exists(key_file): if not os.path.exists(key_file): # pragma: no cover
logger.info(f"Generating random key file at '{key_file}'") logger.info(f"Generating random key file at '{key_file}'")
# Create a random key file # Create a random key file
with open(key_file, 'w') as f: with open(key_file, 'w') as f: