diff --git a/docs/sandboxes/environment-variables.mdx b/docs/sandboxes/environment-variables.mdx index 3cfd944ae..048f4fdb5 100644 --- a/docs/sandboxes/environment-variables.mdx +++ b/docs/sandboxes/environment-variables.mdx @@ -25,6 +25,7 @@ The following environment variables are typically available within Codegen sandb | `NPM_CONFIG_YES` | `"true"` | Configures npm to automatically answer "yes" to prompts. | | `PIP_NO_INPUT` | `"1"` | Instructs pip (Python's package installer) to operate in non-interactive mode. | | `YARN_ENABLE_IMMUTABLE_INSTALLS` | `"false"` | Disables Yarn's "immutable installs" feature, allowing `yarn install` to modify the lockfile. | +| `CG_PREVIEW_URL` | _Dynamic (preview URL)_ | Contains the URL where the web preview will be served. This is automatically set when Web Preview is configured. | The values for variables like `NVM_DIR`, `PATH`, `NVM_BIN`, and `NODE_VERSION` diff --git a/docs/sandboxes/web-preview.mdx b/docs/sandboxes/web-preview.mdx index 957fb10fa..70ab62a3f 100644 --- a/docs/sandboxes/web-preview.mdx +++ b/docs/sandboxes/web-preview.mdx @@ -57,6 +57,13 @@ bundle exec rails server -b 127.0.0.1 -p 3000 Variables](./environment-variables). + + The `CG_PREVIEW_URL` environment variable is automatically set and contains + the URL where your web preview will be accessible. Use this in your + application code when you need to reference the preview URL programmatically + (e.g., for CORS configuration, webhooks, or generating absolute URLs). + + The web preview is intended for development and debugging purposes. The server is typically only accessible while the agent run is active or for a short