chore: don't confuse type checker by fetching after the if (#3344)

This commit is contained in:
nwns 2022-07-17 16:15:52 -06:00 committed by GitHub
parent 6e2a2f2b2c
commit ce0af287f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,9 +114,9 @@ C) Look for default key file "secret_key.txt"
d) Create "secret_key.txt" if it does not exist
"""
if os.getenv("INVENTREE_SECRET_KEY"):
if secret_key := os.getenv("INVENTREE_SECRET_KEY"):
# Secret key passed in directly
SECRET_KEY = os.getenv("INVENTREE_SECRET_KEY").strip() # pragma: no cover
SECRET_KEY = secret_key.strip() # pragma: no cover
logger.info("SECRET_KEY loaded by INVENTREE_SECRET_KEY") # pragma: no cover
else:
# Secret key passed in by file location