Skip to content

Commit

Permalink
chore: turn boolean string into boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed May 21, 2024
1 parent 2c9bc89 commit 3e3cd47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion backend/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@
# Google Cloud Storage
...


# Stripe
STRIPE_LIVE_MODE = bool(getenv("STRIPE_LIVE_MODE", False))
def as_bool(var):
if isinstance(var, str):
if var.lower() in ["true", "t", "1"]:
return True
return False


STRIPE_LIVE_MODE = as_bool(getenv("STRIPE_LIVE_MODE"))
STRIPE_LIVE_SECRET_KEY = getenv("STRIPE_LIVE_SECRET_KEY")
STRIPE_TEST_SECRET_KEY = getenv("STRIPE_TEST_SECRET_KEY")
DJSTRIPE_WEBHOOK_SECRET = getenv("DJSTRIPE_WEBHOOK_SECRET")
Expand Down
10 changes: 9 additions & 1 deletion backend/settings/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,16 @@
},
}


# Stripe
STRIPE_LIVE_MODE = bool(getenv("STRIPE_LIVE_MODE"))
def as_bool(var):
if isinstance(var, str):
if var.lower() in ["true", "t", "1"]:
return True
return False


STRIPE_LIVE_MODE = as_bool(getenv("STRIPE_LIVE_MODE"))
STRIPE_LIVE_SECRET_KEY = getenv("STRIPE_LIVE_SECRET_KEY")
STRIPE_TEST_SECRET_KEY = getenv("STRIPE_TEST_SECRET_KEY")
DJSTRIPE_WEBHOOK_SECRET = getenv("DJSTRIPE_WEBHOOK_SECRET")
Expand Down

0 comments on commit 3e3cd47

Please sign in to comment.