Skip to content

Commit

Permalink
Fix/key (#1066)
Browse files Browse the repository at this point in the history
* fix: don't make OSO_API_KEY required on frontend

* fix: don't make OSO_API_KEY required

* Unbreaks the client-side bundle
  • Loading branch information
ryscheng authored Mar 15, 2024
1 parent 539d7a8 commit e8040be
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/frontend/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Mark an environment as required for the build.
* This is mostly used for convenience of debugging, so that things break early
* Note: this should only be used for environment variables prefixed with "NEXT_PUBLIC_".
* Client-side bundles will be missing other env variables by definition
*/
export const requireEnv = (value: string | undefined, identifier: string) => {
if (!value) {
throw new Error(`Required env var ${identifier} does not exist`);
Expand All @@ -22,7 +28,7 @@ export const DB_GRAPHQL_URL = requireEnv(
"NEXT_PUBLIC_DB_GRAPHQL_URL",
);

export const OSO_API_KEY = requireEnv(process.env.OSO_API_KEY, "OSO_API_KEY");
export const OSO_API_KEY = process.env.OSO_API_KEY ?? "MISSING";

export const SUPABASE_URL = requireEnv(
process.env.NEXT_PUBLIC_SUPABASE_URL,
Expand Down

0 comments on commit e8040be

Please sign in to comment.