Skip to content

Commit

Permalink
Switch to cloudflarepreviews.com (cloudflare#4007)
Browse files Browse the repository at this point in the history
* Switch to cloudflarepreviews.com

* Extract to env vars
  • Loading branch information
penalosa authored Sep 21, 2023
1 parent bc8c147 commit f099a4f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/playground-preview-worker/wrangler.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"define": {
"ROOT": "'playground/devprod/cloudflare/dev'",
"PREVIEW": "':any/playground/devprod/cloudflare/dev'"
"PREVIEW": "':any/cloudflarepreviews/com'"
},

"routes": [
Expand All @@ -26,8 +26,8 @@
"zone_name": "playground.devprod.cloudflare.dev"
},
{
"pattern": "*.playground.devprod.cloudflare.dev/*",
"zone_name": "playground.devprod.cloudflare.dev"
"pattern": "*.cloudflarepreviews.com/*",
"zone_name": "cloudflarepreviews.com"
}
],

Expand Down
2 changes: 2 additions & 0 deletions packages/workers-playground/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_PLAYGROUND_ROOT=playground.devprod.cloudflare.dev
VITE_PLAYGROUND_PREVIEW=cloudflarepreviews.com
3 changes: 2 additions & 1 deletion packages/workers-playground/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ dist-ssr
*.ntvs*
*.njsproj
*.sln
*.sw?
*.sw?
!.env
10 changes: 6 additions & 4 deletions packages/workers-playground/src/QuickEditor/useDraftWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ async function updatePreviewHash(content: Worker): Promise<PreviewHash> {

return {
playgroundUrl: `/playground#${await compressWorker(worker)}`,
previewUrl: `https://${v4()}.playground.devprod.cloudflare.dev/.update-preview-token?token=${encodeURIComponent(
deploy.preview
)}`,
devtoolsUrl: `wss://playground.devprod.cloudflare.dev${deploy.inspector}`,
previewUrl: `https://${v4()}.${
import.meta.env.VITE_PLAYGROUND_PREVIEW
}/.update-preview-token?token=${encodeURIComponent(deploy.preview)}`,
devtoolsUrl: `wss://${import.meta.env.VITE_PLAYGROUND_ROOT}${
deploy.inspector
}`,
};
}

Expand Down

0 comments on commit f099a4f

Please sign in to comment.