From 453f109593941de8a6f80d6f6b0c4847f85e85b3 Mon Sep 17 00:00:00 2001 From: Mario Sergio Date: Wed, 23 Oct 2024 15:46:09 -0300 Subject: [PATCH] fix(webpage-client): removed secret keys from public NextJS config --- clients/packages/webpage-client/src/apis/graphql/index.ts | 2 +- .../webpage-client/src/components/DonationConnected.tsx | 6 +++--- .../src/components/subscriptions/CreditCardForm/submit.ts | 4 ++-- .../src/pages/api/phone/call/[call_id]/status.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/clients/packages/webpage-client/src/apis/graphql/index.ts b/clients/packages/webpage-client/src/apis/graphql/index.ts index e291835c06..ab29192c36 100644 --- a/clients/packages/webpage-client/src/apis/graphql/index.ts +++ b/clients/packages/webpage-client/src/apis/graphql/index.ts @@ -18,7 +18,7 @@ const authLink = setContext((_, { headers }) => { return { headers: { ...headers, - // 'x-hasura-admin-secret': publicRuntimeConfig.apiGraphqlSecret + // 'x-hasura-admin-secret': serverRuntimeConfig.apiGraphqlSecret // authorization: token ? `Bearer ${token}` : "", } } diff --git a/clients/packages/webpage-client/src/components/DonationConnected.tsx b/clients/packages/webpage-client/src/components/DonationConnected.tsx index 7ee23236db..1c9647abb5 100644 --- a/clients/packages/webpage-client/src/components/DonationConnected.tsx +++ b/clients/packages/webpage-client/src/components/DonationConnected.tsx @@ -13,7 +13,7 @@ import fetch from 'node-fetch'; import Utils from '../Utils'; -const { publicRuntimeConfig } = getConfig(); +const { serverRuntimeConfig } = getConfig(); // const mapDispatchToProps = () => ({ // createTransaction: async (args: any) => @@ -76,7 +76,7 @@ const DonationConnected = (props: any) => }) ).json() } - pagarmeKey={publicRuntimeConfig.pagarmeKey || 'setup env var'} + pagarmeKey={serverRuntimeConfig.pagarmeKey || 'setup env var'} donationComponent={DonationPlugin} analyticsEvents={DonationAnalytics} overrides={{ @@ -106,7 +106,7 @@ export default DonationConnected; // )((props: MobProps) => ( // { // @@ -17,7 +17,7 @@ const submit = (values: any) => { // const promise = new Promise((resolve, reject) => { // eslint-disable-next-line - (window as any).PagarMe.encryption_key = publicRuntimeConfig.pagarmeKey; + (window as any).PagarMe.encryption_key = serverRuntimeConfig.pagarmeKey; // eslint-disable-next-line const card = new (window as any).PagarMe.creditCard(); diff --git a/clients/packages/webpage-client/src/pages/api/phone/call/[call_id]/status.ts b/clients/packages/webpage-client/src/pages/api/phone/call/[call_id]/status.ts index 5795da9db8..a68585acf4 100644 --- a/clients/packages/webpage-client/src/pages/api/phone/call/[call_id]/status.ts +++ b/clients/packages/webpage-client/src/pages/api/phone/call/[call_id]/status.ts @@ -8,11 +8,11 @@ interface Request { } const { - publicRuntimeConfig: { - openApiUrl, + publicRuntimeConfig: { openApiUrl }, + serverRuntimeConfig: { // openApiToken } -} = getConfig() +} = getConfig(); export default async (req: Request, res: any) => { if (req.method === 'GET') {