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

This commit is contained in:
nwns
2022-07-18 08:15:52 +10:00
committed by GitHub
parent 6e2a2f2b2c
commit ce0af287f2
+2 -2
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