This repository was archived by the owner on May 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ CONTENTSTACK_ENVIRONMENT=your_environment_token
88
99# Below config options are for enabling live preview/live edit tags for the starter app
1010
11- CONTENTSTACK_PREVIEW_HOST = rest-preview.contentstack.com
11+ # CONTENTSTACK_PREVIEW_HOST= rest-preview.contentstack.com -- it will be generated runtime from CONTENTSTACK_APP_HOST
1212CONTENTSTACK_PREVIEW_TOKEN = your_live_preview_token
1313CONTENTSTACK_APP_HOST = app.contentstack.com
1414CONTENTSTACK_LIVE_PREVIEW = true
Original file line number Diff line number Diff line change @@ -2,4 +2,8 @@ fileignoreconfig:
22- filename: .github/workflows/secrets-scan.yml
33 ignore_detectors:
44 - filecontent
5+ - filename: .env.sample
6+ checksum: 5cb7389df244ea0f5c62e6f156ea038d0725e46d52662ca479e671108bdd966b
7+ - filename: setenv.ts
8+ checksum: 243eb74a14fc02eaacd1e632b498387b946b929807ff8687931bb1e530002541
59version: "1.0"
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ const stackConfig = {
1111 branch : process . env . CONTENTSTACK_BRANCH || 'main' ,
1212 region : process . env . CONTENTSTACK_REGION || 'us' ,
1313} ;
14+
15+ // Calculate preview_host from app_host if available and preview_host is not explicitly set
16+ const appHost = process . env . CONTENTSTACK_APP_HOST ;
17+ const previewHost = process . env . CONTENTSTACK_PREVIEW_HOST ||
18+ ( appHost ? appHost . replace ( 'app' , 'rest-preview' ) : undefined ) ;
19+
1420const environmentFileContent = `
1521export const environment = {
1622 production: true
@@ -23,7 +29,7 @@ export const Config = {
2329 branch: '${ process . env . CONTENTSTACK_BRANCH || 'main' } ',
2430 region: '${ process . env . CONTENTSTACK_REGION || 'us' } ',
2531 preview_token:'${ process . env . CONTENTSTACK_PREVIEW_TOKEN } ',
26- preview_host:'${ process . env . CONTENTSTACK_PREVIEW_HOST } ',
32+ preview_host:'${ previewHost } ',
2733 api_host:'${ process . env . CONTENTSTACK_API_HOST } ',
2834 app_host:'${ process . env . CONTENTSTACK_APP_HOST } ',
2935 live_preview:${ process . env . CONTENTSTACK_LIVE_PREVIEW || true }
You can’t perform that action at this time.
0 commit comments