Skip to content

Commit

Permalink
Rename ZAPPS env var to EMBEDDED_ZAPPS for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Sep 24, 2024
1 parent c98232b commit 5d998d9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions apps/passport-client/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ ZAPP_ALLOWED_SIGNER_ORIGINS='["http://example.com","http://localhost:3200"]'

# To configure Zapps, set this to a JSON object with folder names as keys and URLs as values.
# These will appear as folders in Zupass.
#ZAPPS={"Pondcrypto": "http://localhost:3200", "Meerkat": "http://localhost:3201"}
ZAPPS=
#EMBEDDED_ZAPPS={"Pondcrypto": "http://localhost:3200", "Meerkat": "http://localhost:3201"}
EMBEDDED_ZAPPS=
4 changes: 2 additions & 2 deletions apps/passport-client/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ const define = {
)
}
: {}),
...(process.env.ZAPPS !== undefined
...(process.env.EMBEDDED_ZAPPS !== undefined
? {
"process.env.ZAPPS": JSON.stringify(process.env.ZAPPS)
"process.env.EMBEDDED_ZAPPS": JSON.stringify(process.env.EMBEDDED_ZAPPS)
}
: {})
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export function HomeScreenImpl(): JSX.Element | null {
const isFrogCrypto = isFrogCryptoFolder(browsingFolder);
const isEdgeCity = isEdgeCityFolder(browsingFolder);
const isProtocolWorlds = isProtocolWorldsFolder(browsingFolder);
const isZappFolder = !!appConfig.zapps[browsingFolder];
const isZappFolder = !!appConfig.embeddedZapps[browsingFolder];

const shouldShowFrogCrypto = useMemo(() => {
const folders = pcdCollection.value.getAllFolderNames();
Expand Down Expand Up @@ -216,7 +216,7 @@ export function HomeScreenImpl(): JSX.Element | null {
/>
)}
{isRoot &&
Object.keys(appConfig.zapps).map((folder) => (
Object.keys(appConfig.embeddedZapps).map((folder) => (
<FolderCard
key={folder}
onFolderClick={onFolderClick}
Expand All @@ -233,7 +233,7 @@ export function HomeScreenImpl(): JSX.Element | null {
) : isEdgeCity ? (
<EdgeCityHome />
) : isZappFolder ? (
<ZappScreen url={appConfig.zapps[browsingFolder]} />
<ZappScreen url={appConfig.embeddedZapps[browsingFolder]} />
) : (
<>
{!(foldersInFolder.length === 0 && isRoot) && <Separator />}
Expand Down
14 changes: 8 additions & 6 deletions apps/passport-client/src/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface AppConfig {
// origins that are allowed to sign PODs
zappAllowedSignerOrigins: string[];
// folder name -> zapp URL
zapps: Record<string, string>;
embeddedZapps: Record<string, string>;
}

if (
Expand Down Expand Up @@ -62,13 +62,15 @@ try {
zappAllowedSignerOrigins = [];
}

let zapps: Record<string, string> = {};
let embeddedZapps: Record<string, string> = {};

try {
zapps = process.env.ZAPPS ? JSON.parse(process.env.ZAPPS) : {};
embeddedZapps = process.env.EMBEDDED_ZAPPS
? JSON.parse(process.env.EMBEDDED_ZAPPS)
: {};
} catch (e) {
console.error("Failed to parse ZAPPS", e);
zapps = {};
console.error("Failed to parse EMBEDDED_ZAPPS", e);
embeddedZapps = {};
}

export const appConfig: AppConfig = {
Expand All @@ -81,7 +83,7 @@ export const appConfig: AppConfig = {
strichLicenseKey: process.env.STRICH_LICENSE_KEY,
zappRestrictOrigins: process.env.ZAPP_RESTRICT_ORIGINS === "true",
zappAllowedSignerOrigins: zappAllowedSignerOrigins,
zapps: zapps
embeddedZapps: embeddedZapps
};

console.log("App Config: " + JSON.stringify(appConfig));
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"ZAPP_RESTRICT_ORIGINS",
"ZAPP_ALLOWED_SIGNER_ORIGINS",
"CLIENT_URL",
"ZAPPS",
"EMBEDDED_ZAPPS",
"//// add env vars above this line ////"
],
"globalEnv": [
Expand Down

0 comments on commit 5d998d9

Please sign in to comment.