Skip to content

Commit

Permalink
fix: DEBUG always return True
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Jul 24, 2023
1 parent d559f16 commit 549b659
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nexus/core/constants.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os
from nexus.utils.humanize import str_bool


REQUEST_TIMEOUT = 2500
REQUEST_RETRIES = 3
PREFIX_V1 = "/v1"
PREFIX_V2 = "/v2"
NEXUS_EPOCH = 1689740330
DEBUG = bool(os.getenv("DASHBOARD_IS_DEBUG", 0))
DEBUG = str_bool(os.getenv("DASHBOARD_IS_DEBUG", "0"))
SESSION_EXPIRY = 14 * 24 * 60 * 60 # 14 days
SESSION_EXPIRY_DEBUG = 24 * 60 * 60
7 changes: 7 additions & 0 deletions nexus/utils/humanize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def str_bool(string: str) -> bool:
lowered = string.lower()
if lowered in ("yes", "y", "true", "t", "1", "enable", "on"):
return True
elif lowered in ("no", "n", "false", "f", "0", "disable", "off"):
return False
raise ValueError("Invalid Input")

0 comments on commit 549b659

Please sign in to comment.