Refactor infisical-node to config file for birds eye view of envars

This commit is contained in:
Tuan Dang
2023-03-15 00:09:40 +07:00
parent 31111fc63b
commit a6c8638345
33 changed files with 264 additions and 262 deletions
@@ -1,7 +1,7 @@
import * as Sentry from '@sentry/node';
import infisical from 'infisical-node';
import { Request, Response } from 'express';
import Stripe from 'stripe';
import { getStripeSecretKey, getStripeWebhookSecret } from '../../../config';
/**
* Handle service provisioning/un-provisioning via Stripe
@@ -12,7 +12,7 @@ import Stripe from 'stripe';
export const handleWebhook = async (req: Request, res: Response) => {
let event;
try {
const stripe = new Stripe(infisical.get('STRIPE_SECRET_KEY')!, {
const stripe = new Stripe(getStripeSecretKey(), {
apiVersion: '2022-08-01'
});
@@ -21,7 +21,7 @@ export const handleWebhook = async (req: Request, res: Response) => {
event = stripe.webhooks.constructEvent(
req.body,
sig,
infisical.get('STRIPE_WEBHOOK_SECRET')!
getStripeWebhookSecret()
);
} catch (err) {
Sentry.setUser({ email: req.user.email });