From 09ffd5588c71cc26948bd02b0630654c1fb2c1fe Mon Sep 17 00:00:00 2001 From: Chris Grimmett Date: Tue, 27 Feb 2024 09:57:40 -0800 Subject: [PATCH] detect undefined env vars --- ARCHITECHTURE.md | 8 +++++--- packages/next/app/lib/constants.ts | 9 ++++++--- packages/next/app/uppy.tsx | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ARCHITECHTURE.md b/ARCHITECHTURE.md index 4b8ee56..db37e59 100644 --- a/ARCHITECHTURE.md +++ b/ARCHITECHTURE.md @@ -1,8 +1,10 @@ -Monorepo. pnpm required for workspaces. +git monorepo. -packages/strapi requires Yarn. +pnpm required for workspaces. -Development uses dockerfile with dotenv. +Yarn required for packages/strapi + +Development uses docker compose with dotenv. Production uses dokku. diff --git a/packages/next/app/lib/constants.ts b/packages/next/app/lib/constants.ts index c7cdf36..be054f9 100644 --- a/packages/next/app/lib/constants.ts +++ b/packages/next/app/lib/constants.ts @@ -1,5 +1,8 @@ -// export const strapiUrl = (process.env.NODE_ENV === 'production') ? 'https://portal.futureporn.net' : 'https://chisel.sbtp:1337' -// export const siteUrl = (process.env.NODE_ENV === 'production') ? 'https://futureporn.net' : 'http://localhost:3000' +if (!process.env.NEXT_PUBLIC_SITE_URL) throw new Error('NEXT_PUBLIC_SITE_URL was missing in env'); +if (!process.env.NEXT_PUBLIC_STRAPI_URL) throw new Error('NEXT_PUBLIC_STRAPI_URL was missing in env'); +if (!process.env.NEXT_PUBLIC_UPPY_COMPANION_URL) throw new Error('NEXT_PUBLIC_UPPY_COMPANION_URL undefined in env'); + +export const companionUrl = process.env.NEXT_PUBLIC_UPPY_COMPANION_URL export const siteUrl = ''+process.env.NEXT_PUBLIC_SITE_URL export const strapiUrl = ''+process.env.NEXT_PUBLIC_STRAPI_URL export const patreonSupporterBenefitId: string = '4760169' @@ -17,4 +20,4 @@ export const authorName = 'CJ_Clippy' export const authorEmail = 'cj@futureporn.net' export const authorLink = 'https://futureporn.net' export const giteaUrl = 'https://gitea.futureporn.net' -export const projektMelodyEpoch = new Date('2020-02-07T23:21:48.000Z') \ No newline at end of file +export const projektMelodyEpoch = new Date('2020-02-07T23:21:48.000Z') diff --git a/packages/next/app/uppy.tsx b/packages/next/app/uppy.tsx index 64279fc..98c4abc 100644 --- a/packages/next/app/uppy.tsx +++ b/packages/next/app/uppy.tsx @@ -5,8 +5,8 @@ import Uppy from '@uppy/core'; import AwsS3 from '@uppy/aws-s3'; import RemoteSources from '@uppy/remote-sources'; import { useAuth } from './components/auth'; +import { companionUrl } from '@/lib/constants'; -const companionUrl = process.env.NEXT_PUBLIC_UPPY_COMPANION_URL! export const UppyContext = createContext(new Uppy());