Skip to content

Commit 03fef42

Browse files
authored
chore: cleanup config usage (#103)
1 parent 94d70e6 commit 03fef42

20 files changed

+59
-45
lines changed

.env.sample

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
NODE_ENV=production
21
DATABASE_URL=postgres://postgres:postgres@host:5432/postgres?sslmode=disable&search_path=stripe
3-
STRIPE_SECRET_KEY=sk_test_
42
STRIPE_WEBHOOK_SECRET=whsec_
3+
API_KEY=api_key_test
4+
5+
# optional
56
SCHEMA=stripe
7+
8+
# optional, only needed when you want to actively sync data and call the Stripe API, not needed for webhook processing
9+
STRIPE_SECRET_KEY=sk_test_
10+
11+
# optional
612
PORT=8080
7-
API_KEY=api_key_test
13+
14+
# optional
815
STRIPE_API_VERSION="2020-08-27"

docker/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3.8'
33
services:
44
db:
55
container_name: stripe-db
6-
image: supabase/postgres:15.1.0.125
6+
image: supabase/postgres:15.1.1.4
77
command: postgres -c config_file=/etc/postgresql/postgresql.conf
88
restart: unless-stopped
99
ports:

src/lib/charges.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export const upsertCharges = async (
2020
])
2121
}
2222

23-
return upsertMany(charges, () =>
24-
constructUpsertSql(config.SCHEMA || 'stripe', 'charges', chargeSchema)
25-
)
23+
return upsertMany(charges, () => constructUpsertSql(config.SCHEMA, 'charges', chargeSchema))
2624
}
2725

2826
export const backfillCharges = async (chargeIds: string[]) => {

src/lib/customers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export const upsertCustomers = async (
1414
return upsertMany(customers, (customer) => {
1515
// handle deleted customer
1616
if (customer.deleted) {
17-
return constructUpsertSql(config.SCHEMA || 'stripe', 'customers', customerDeletedSchema)
17+
return constructUpsertSql(config.SCHEMA, 'customers', customerDeletedSchema)
1818
} else {
19-
return constructUpsertSql(config.SCHEMA || 'stripe', 'customers', customerSchema)
19+
return constructUpsertSql(config.SCHEMA, 'customers', customerSchema)
2020
}
2121
})
2222
}

src/lib/disputes.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ export const upsertDisputes = async (
1515
await backfillCharges(getUniqueIds(disputes, 'charge'))
1616
}
1717

18-
return upsertMany(disputes, () =>
19-
constructUpsertSql(config.SCHEMA || 'stripe', 'disputes', disputeSchema)
20-
)
18+
return upsertMany(disputes, () => constructUpsertSql(config.SCHEMA, 'disputes', disputeSchema))
2119
}

src/lib/invoices.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ export const upsertInvoices = async (
2121
])
2222
}
2323

24-
return upsertMany(invoices, () =>
25-
constructUpsertSql(config.SCHEMA || 'stripe', 'invoices', invoiceSchema)
26-
)
24+
return upsertMany(invoices, () => constructUpsertSql(config.SCHEMA, 'invoices', invoiceSchema))
2725
}
2826

2927
export const backfillInvoices = async (invoiceIds: string[]) => {

src/lib/payment_intents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ export const upsertPaymentIntents = async (
2020
}
2121

2222
return upsertMany(paymentIntents, () =>
23-
constructUpsertSql(config.SCHEMA || 'stripe', 'payment_intents', paymentIntentSchema)
23+
constructUpsertSql(config.SCHEMA, 'payment_intents', paymentIntentSchema)
2424
)
2525
}

src/lib/payment_methods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export const upsertPaymentMethods = async (
1616
}
1717

1818
return upsertMany(paymentMethods, () =>
19-
constructUpsertSql(config.SCHEMA || 'stripe', 'payment_methods', paymentMethodsSchema)
19+
constructUpsertSql(config.SCHEMA, 'payment_methods', paymentMethodsSchema)
2020
)
2121
}

src/lib/plans.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const upsertPlans = async (
1717
await backfillProducts(getUniqueIds(plans, 'product'))
1818
}
1919

20-
return upsertMany(plans, () => constructUpsertSql(config.SCHEMA || 'stripe', 'plans', planSchema))
20+
return upsertMany(plans, () => constructUpsertSql(config.SCHEMA, 'plans', planSchema))
2121
}
2222

2323
export const deletePlan = async (id: string): Promise<boolean> => {

src/lib/prices.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ export const upsertPrices = async (
1717
await backfillProducts(getUniqueIds(prices, 'product'))
1818
}
1919

20-
return upsertMany(prices, () =>
21-
constructUpsertSql(config.SCHEMA || 'stripe', 'prices', priceSchema)
22-
)
20+
return upsertMany(prices, () => constructUpsertSql(config.SCHEMA, 'prices', priceSchema))
2321
}
2422

2523
export const deletePrice = async (id: string): Promise<boolean> => {

0 commit comments

Comments
 (0)