Skip to content

Commit

Permalink
Move endpoint check to function body
Browse files Browse the repository at this point in the history
  • Loading branch information
underbluewaters committed Oct 4, 2024
1 parent 24df344 commit 93ddfca
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/api/src/plugins/metadataParserPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ const REQUIRED_ENV_VARS = [

const MetadataParserPlugin = makeExtendSchemaPlugin((build) => {
const { pgSql: sql } = build;
for (const envvar of REQUIRED_ENV_VARS) {
if (!process.env[envvar]) {
throw new Error(`Missing env var ${envvar}`);
}
}
return {
typeDefs: gql`
extend type Mutation {
Expand All @@ -42,6 +37,12 @@ const MetadataParserPlugin = makeExtendSchemaPlugin((build) => {
context,
resolveInfo
) => {
for (const envvar of REQUIRED_ENV_VARS) {
if (!process.env[envvar]) {
throw new Error(`Missing env var ${envvar}`);
}
}

const { pgClient } = context;

const data = await metadataToProseMirror(args.xmlMetadata);
Expand Down

0 comments on commit 93ddfca

Please sign in to comment.