Skip to content

Commit

Permalink
feat: Update environment variable retrieval in
Browse files Browse the repository at this point in the history
codebase
  • Loading branch information
CharlesNg35 committed Dec 12, 2023
1 parent e4df6d2 commit 586b63f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions apps/web/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export const RECAPTCHA_SITE_KEY = getNextPublicEnv('NEXT_PUBLIC_CAPTCHA_SITE_KEY
export const RECAPTCHA_SECRET_KEY = process.env.CAPTCHA_SECRET_KEY;

export const GAUZY_API_SERVER_URL = process.env.GAUZY_API_SERVER_URL || 'https://api.gauzy.co/api';
export const GAUZY_API_BASE_SERVER_URL = getNextPublicEnv('NEXT_PUBLIC_GAUZY_API_SERVER_URL', 'https://api.gauzy.co');

// Invite
export const INVITE_CALLBACK_URL = process.env.INVITE_CALLBACK_URL || 'https://app.ever.team/auth/passcode';
export const INVITE_CALLBACK_PATH = '/auth/passcode';
export const VERIFY_EMAIL_CALLBACK_URL = process.env.VERIFY_EMAIL_CALLBACK_URL || 'https://app.ever.team/verify-email';
Expand Down Expand Up @@ -88,8 +90,8 @@ export const BOARD_FIREBASE_CONFIG = getNextPublicEnv('NEXT_PUBLIC_BOARD_FIREBAS

// Jitsu
export const jitsuConfiguration: () => JitsuOptions = () => ({
host: process.env.NEXT_PUBLIC_JITSU_BROWSER_URL || '',
writeKey: process.env.NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY || '',
host: getNextPublicEnv('NEXT_PUBLIC_JITSU_BROWSER_URL', '').value,
writeKey: getNextPublicEnv('NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY', '').value,
// if enabled - events will be sent to the console but no data sent to Jitsu.
// Strange this is not mentioned in the documentation https://github.com/jitsucom/jitsu/blob/35c4ecaff54d61a87853381cb17262b7bfbd4a6e/libs/jitsu-js/src/jitsu.ts#L40
echoEvents: false,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/services/client/api/employee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function getWorkingEmployeesAPI(tenantId: string, organizationId: s
'where[organizationId]': organizationId,
'relations[0]': 'user'
};
const query = new URLSearchParams(params);
const query = new URLSearchParams(params);

const endpoint = process.env.NEXT_PUBLIC_GAUZY_API_SERVER_URL
? `/employee/pagination?${query.toString()}`
Expand Down
6 changes: 3 additions & 3 deletions apps/web/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-mixed-spaces-and-tabs */
import { loadNextPublicEnvs, setNextPublicEnv } from '@app/env';
import { getNextPublicEnv, loadNextPublicEnvs, setNextPublicEnv } from '@app/env';
import { GA_MEASUREMENT_ID, jitsuConfiguration } from '@app/constants';
import { JitsuProvider } from '@jitsu/jitsu-react';
import { Analytics } from '@vercel/analytics/react';
Expand Down Expand Up @@ -85,8 +85,8 @@ const MyApp = ({ Component, pageProps }: AppProps) => {

MyApp.getInitialProps = async ({ Component, ctx }: { Component: NextPage<AppProps>; ctx: NextPageContext }) => {
// Recover environment variables
const jitsuHost = process.env.NEXT_PUBLIC_JITSU_BROWSER_URL;
const jitsuWriteKey = process.env.NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY;
const jitsuHost = getNextPublicEnv('NEXT_PUBLIC_JITSU_BROWSER_URL').value;
const jitsuWriteKey = getNextPublicEnv('NEXT_PUBLIC_JITSU_BROWSER_WRITE_KEY').value;

const jitsuConf = jitsuConfiguration();

Expand Down

0 comments on commit 586b63f

Please sign in to comment.