Skip to content

Commit

Permalink
added STRIPE_TEST_OVERRIDE
Browse files Browse the repository at this point in the history
  • Loading branch information
Somraj-234 committed Aug 11, 2024
1 parent 945044d commit 7a4c4cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/5-scheduled-production-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
test:
runs-on: ubuntu-latest
env:
DJANGO_DEBUG: ${{ secrets.DJANGO_DEBUG }}
DJANGO_DEBUG: 0
STRIPE_TEST_OVERRIDE: 1
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
NEON_API_KEY: ${{ secrets.NEON_API_KEY}}
NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID}}
Expand Down
4 changes: 3 additions & 1 deletion src/helper/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
DJANGO_DEBUG = config('DJANGO_DEBUG', default=False, cast=bool)
STRIPE_SECRET_KEY = config("STRIPE_SECRET_KEY", default="", cast=str)

if "sk_test" in STRIPE_SECRET_KEY and not DJANGO_DEBUG:
STRIPE_TEST_OVERRIDE = config("STRIPE_TEST_OVERRIDE", default=False, cast=bool)

if "sk_test" in STRIPE_SECRET_KEY and not DJANGO_DEBUG and not STRIPE_TEST_OVERRIDE:
raise ValueError("Invalid stripe key for production")

stripe.api_key = STRIPE_SECRET_KEY
Expand Down

0 comments on commit 7a4c4cb

Please sign in to comment.