From cb5d1ac0fd6c9ff80eecb37c37b2c362b35fc15f Mon Sep 17 00:00:00 2001 From: Nicholas Langford Date: Sat, 22 Jun 2024 01:59:20 +1000 Subject: [PATCH] Merge .env and .env.local --- .env.example | 12 +++++++++++- .env.local.example | 10 ---------- pages/merch.tsx | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 .env.local.example diff --git a/.env.example b/.env.example index ff3b478..5d016b1 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,11 @@ -STRIPE_TEST_KEY=insert stripe test secret: sk_test... +# From https://docs.stripe.com/checkout/embedded/quickstart?client=next#set-env-vars + +# Copy into .env and replace the placeholder values with the real keys. + # https://dashboard.stripe.com/apikeys + # https://dashboard.stripe.com/test/apikeys + # https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables +NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_12345 +STRIPE_SECRET_KEY=sk_test_12345 + +# Set this environment variable to support webhooks — https://stripe.com/docs/webhooks#verify-events +# STRIPE_WEBHOOK_SECRET=whsec_12345 diff --git a/.env.local.example b/.env.local.example deleted file mode 100644 index c552867..0000000 --- a/.env.local.example +++ /dev/null @@ -1,10 +0,0 @@ -# From https://docs.stripe.com/checkout/embedded/quickstart?client=next#set-env-vars - -# Copy into .env.local and replace the placeholder values with the real keys. - # https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables - # https://dashboard.stripe.com/apikeys - # https://dashboard.stripe.com/test/apikeys -NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_12345 -STRIPE_SECRET_KEY=sk_test_12345 -# Set this environment variable to support webhooks — https://stripe.com/docs/webhooks#verify-events -# STRIPE_WEBHOOK_SECRET=whsec_12345 diff --git a/pages/merch.tsx b/pages/merch.tsx index 55b67a5..f9f6e0d 100644 --- a/pages/merch.tsx +++ b/pages/merch.tsx @@ -40,7 +40,7 @@ type Repo = { export const getServerSideProps = async () => { // Ideally should be moved out to not initialise on every render // eslint-disable-next-line @typescript-eslint/no-var-requires - const stripe: Stripe = require("stripe")(process.env["STRIPE_TEST_KEY"]); + const stripe: Stripe = require("stripe")(process.env["STRIPE_SECRET_KEY"]); const { products, variants } = await getAllProductsAndVariants(stripe); const prices = await getAllPrices(stripe);