Skip to content

Commit

Permalink
Use base64 encoding for .env.site-configs
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxachun committed Jan 9, 2025
1 parent 3b978d6 commit e755b93
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo/admin/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function createConfig() {
...cometConfig,
apiUrl: environmentVariables.API_URL,
adminUrl: environmentVariables.ADMIN_URL,
sitesConfig: JSON.parse(environmentVariables.PUBLIC_SITE_CONFIGS) as PublicSiteConfig[],
sitesConfig: JSON.parse(atob(environmentVariables.PUBLIC_SITE_CONFIGS)) as PublicSiteConfig[],
buildDate: environmentVariables.BUILD_DATE,
buildNumber: environmentVariables.BUILD_NUMBER,
commitSha: environmentVariables.COMMIT_SHA,
Expand Down
2 changes: 1 addition & 1 deletion demo/api/src/config/environment-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ export class EnvironmentVariables {
SITE_PREVIEW_SECRET: string;

@IsArray()
@Transform(({ value }) => JSON.parse(value))
@Transform(({ value }) => JSON.parse(Buffer.from(value, "base64").toString()))
PRIVATE_SITE_CONFIGS: PrivateSiteConfig[];
}
2 changes: 1 addition & 1 deletion demo/site/src/util/siteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function getSiteConfigs() {
if (!siteConfigs) {
const json = process.env.PUBLIC_SITE_CONFIGS;
if (!json) throw new Error("process.env.PUBLIC_SITE_CONFIGS must be set.");
siteConfigs = JSON.parse(json) as PublicSiteConfig[];
siteConfigs = JSON.parse(atob(json)) as PublicSiteConfig[];
}
return siteConfigs;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"license": "BSD-2-Clause",
"scripts": {
"create-site-configs-env": "npx @comet/cli inject-site-configs -f demo/site-configs/site-configs.ts -i demo/.env.site-configs.tpl -o demo/.env.site-configs -d",
"create-site-configs-env": "npx @comet/cli inject-site-configs -f demo/site-configs/site-configs.ts -i demo/.env.site-configs.tpl -o demo/.env.site-configs -b",
"build:storybook": "pnpm recursive --filter '@comet/*admin*' --filter '@comet/eslint-plugin' --filter '@comet/cli' run build && pnpm --filter comet-storybook run build-storybook",
"build:packages": "pnpm recursive --filter '@comet/*' run build",
"build:docs": "pnpm recursive --filter '@comet/eslint-plugin' --filter '@comet/admin*' --filter 'comet-docs' run build",
Expand Down

0 comments on commit e755b93

Please sign in to comment.