Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CONTENTSTACK_ENVIRONMENT=your_environment_token

# Below config options are for enabling live preview/live edit tags for the starter app

CONTENTSTACK_PREVIEW_HOST= rest-preview.contentstack.com
# CONTENTSTACK_PREVIEW_HOST= rest-preview.contentstack.com -- it will be generated runtime from CONTENTSTACK_APP_HOST
CONTENTSTACK_PREVIEW_TOKEN= your_live_preview_token
CONTENTSTACK_APP_HOST=app.contentstack.com
CONTENTSTACK_LIVE_PREVIEW= true
Expand Down
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ fileignoreconfig:
- filename: .github/workflows/secrets-scan.yml
ignore_detectors:
- filecontent
- filename: .env.sample
checksum: 5cb7389df244ea0f5c62e6f156ea038d0725e46d52662ca479e671108bdd966b
- filename: setenv.ts
checksum: 243eb74a14fc02eaacd1e632b498387b946b929807ff8687931bb1e530002541
version: "1.0"
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Contentstack
Copyright (c) 2025 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"config": "ts-node setenv.ts"
},
"engines": {
"node": "^14 || ^16"
"node": ">=18.0.0"
},
"license": "MIT",
"author": "Contentstack",
Expand Down
8 changes: 7 additions & 1 deletion setenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ const stackConfig = {
branch: process.env.CONTENTSTACK_BRANCH || 'main',
region: process.env.CONTENTSTACK_REGION || 'us',
};

// Calculate preview_host from app_host if available and preview_host is not explicitly set
const appHost = process.env.CONTENTSTACK_APP_HOST;
const previewHost = process.env.CONTENTSTACK_PREVIEW_HOST ||
(appHost ? appHost.replace('app', 'rest-preview') : undefined);

const environmentFileContent = `
export const environment = {
production: true
Expand All @@ -23,7 +29,7 @@ export const Config = {
branch: '${process.env.CONTENTSTACK_BRANCH || 'main'}',
region: '${process.env.CONTENTSTACK_REGION || 'us'}',
preview_token:'${process.env.CONTENTSTACK_PREVIEW_TOKEN}',
preview_host:'${process.env.CONTENTSTACK_PREVIEW_HOST}',
preview_host:'${previewHost}',
api_host:'${process.env.CONTENTSTACK_API_HOST}',
app_host:'${process.env.CONTENTSTACK_APP_HOST}',
live_preview:${process.env.CONTENTSTACK_LIVE_PREVIEW || true}
Expand Down
Loading