Skip to content

Commit

Permalink
passport API keys are required only in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityblast committed May 28, 2024
1 parent ef9f6b2 commit cc509c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ REACT_APP_PINATA_JWT=TEST

###############################################################
# NOT REQUIRED:
# Passport API keys are not required in local the dapps
# Passport API keys are not required in local. The dapps
# will log an error at checkout when they are used.
# Set your own API keys if you want to use the Passport APIs.
###############################################################
Expand Down
20 changes: 19 additions & 1 deletion packages/common/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,30 @@ export function getConfig(
passportCommunityId: z
.string()
.parse(process.env.REACT_APP_PASSPORT_API_COMMUNITY_ID),
passportAPIKey: z.string().parse(process.env.REACT_APP_PASSPORT_API_KEY),
passportAPIKey: z
.string()
.default("")
.refine((value) => {
if (process.env.NODE_ENV === "production" && value.length === 0) {
return false;
}

return true;
}, "Passport API key is required in production")
.parse(process.env.REACT_APP_PASSPORT_API_KEY),
passportAvalancheCommunityId: z
.string()
.parse(process.env.REACT_APP_PASSPORT_API_COMMUNITY_ID_AVALANCHE),
passportAvalancheAPIKey: z
.string()
.default("")
.refine((value) => {
if (process.env.NODE_ENV === "production" && value.length === 0) {
return false;
}

return true;
}, "Passport Avalanche API key is required in production")
.parse(process.env.REACT_APP_PASSPORT_AVALANCHE_API_KEY),
},
};
Expand Down

0 comments on commit cc509c7

Please sign in to comment.