Preview service connections
Declare the service addresses and credentials editors can supply for a local preview.
Use studio.connections.json beside package.json if the local preview needs an external service. Commit the field definitions. Editors enter the values under Website → Preview connections on their own device. Saving applies the values to the preview process. Use website default clears an override.
{
"connections": [{
"id": "catalogue",
"label": "Gallery catalogue",
"fields": [
{ "env": "APP_CATALOGUE_URL", "label": "Service address", "kind": "url" },
{ "env": "APP_CATALOGUE_KEY", "label": "Access key", "kind": "secret" }
]
}]
}
| Key | Values and effect |
|---|---|
connections | Required array, up to 20 connections. Without the file, the website declares no connection fields. The file limit is 64 KiB. Unknown keys are rejected. |
id, label, description | Each connection requires a unique, nonempty ID and a nonempty display label. The optional description explains what the service supplies. |
fields | Required, nonempty array of inputs for the connection. |
fields[].env | Required environment variable name, unique across the file, up to 128 characters. Use uppercase letters, digits, and underscores with prefix APP_, PUBLIC_, VITE_, or NUXT_. Studio reserves NUXT_PORT, NUXT_HOST, and NUXT_ROOT_DIR. |
fields[].kind | Required. Use text, url, or secret. A secret requires a server-side name. Public prefixes PUBLIC_, VITE_, and NUXT_PUBLIC_ are rejected for secrets. |
fields[].label and fields[].help | Required nonempty display label and optional help text for the editor. |
fields[].required | Optional boolean, default false. Marks a value the service needs. An editor can leave it empty when the website already supplies it. |