Documentation menu

Documentation › Reference

Environment variables

Every environment variable Galley reads — the server, the CLI, the engine, the plugins, the site kit and the desktop app — with its default. Checked against the source on every build of this site.

This page is for developers and whoever runs Galley. Command-line options beat variables; variables beat defaults. This site's build fails if the source reads a GALLEY_* variable that has no row here, or a row names one the source no longer reads.

Link to this section: Where Galley keeps things

VariableDefaultMeaning
GALLEY_HOME~/.galleyThe Galley home: the sites list, settings, keys, conversations, the inbox, per-site state. The CLI, the desktop app and a hosted server share it when they share this value. Settings and secrets.
GALLEY_SITES_DIR<GALLEY_HOME>/sitesWhere cloned and new sites go. Hosted: the only folder sites can be opened from, cloned into or created in.
GALLEY_STARTERS_DIRthe repository's starters/The starters, one folder each.
GALLEY_WEB_DIRpackages/web/distThe built app screens. Without an index.html there, the server shows a page saying how to build them.

Link to this section: The server

VariableDefaultMeaning
GALLEY_HOST127.0.0.1The interface to listen on. Anything but a loopback address means hosted mode, which needs GALLEY_PASSWORD. galley serve defaults to 0.0.0.0.
GALLEY_PORT4400The port. On your own computer a busy port moves to the next free one (and says so); in hosted mode and for the desktop app it is an error.
GALLEY_PASSWORD—Hosted mode's one shared sign-in password, 12 characters or more. Required there. Read from the environment only.
GALLEY_PUBLIC_URL—Hosted: the address people use, e.g. https://cms.example.com. Used for the Host and Origin checks, the previews' addresses, the forms' capture address and the MCP endpoint.
GALLEY_TRUST_PROXYoff1: honour X-Forwarded-Proto and X-Forwarded-For from a reverse proxy you control.
GALLEY_TOKENrandomOn your own computer: the session token in the printed link (32 random bytes when unset). Hosted: optional; set it to allow Authorization: Bearer for scripts. 16 characters or more.
GALLEY_PREVIEW_PORTSany free portA port range for the previews and their proxies, e.g. 4410-4429 — for a firewall or a container that publishes fixed ports.
GALLEY_DESKTOPoff1: the desktop app is the host (/api/meta says desktop: true). Set by the app.
GALLEY_SITEthe current folderpnpm dev inside the repository: the site to open.

Link to this section: The assistant, pictures and keys

Keys are looked for in this order: the site's own key (Site settings › Connections), then the environment, then the key saved in App settings.

VariableDefaultMeaning
ANTHROPIC_API_KEY—The assistant's key.
GALLEY_ANTHROPIC_BASE_URLhttps://api.anthropic.comSend assistant requests to this address instead, e.g. a gateway. ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are ignored on purpose.
GALLEY_AI_PROFILE—full or plain: pin the assistant's request shape instead of starting full and falling back (Connect the assistant).
OPENAI_API_KEY—OpenAI image generation.
GEMINI_API_KEY—Google image generation.
GOOGLE_API_KEY—Google image generation, when GEMINI_API_KEY isn't set.
OPENROUTER_API_KEY—The OpenRouter plugin's key (images and videos), when it isn't saved in Plugins.

Link to this section: Putting sites online

VariableDefaultMeaning
CLOUDFLARE_API_TOKEN—The Cloudflare access key. Beats the one saved in the app; a site's own key beats it.
CLOUDFLARE_ACCOUNT_ID—Which Cloudflare account, when the key reaches several.
VERCEL_TOKEN—The Vercel access key.
VERCEL_TEAM_ID—Which Vercel team.
GALLEY_DEPLOY_<HOST>_APIthe host's own APITesting only: send a host's API calls to another address (a fake host). <HOST> is the host's id in capitals.
GALLEY_REDIRECTS_CLOUDFLARE_APIhttps://api.cloudflare.com/client/v4Testing only: the API address for setting redirects on Cloudflare.

Link to this section: Forms and e-mail

VariableDefaultMeaning
GALLEY_SMTP_URL—The mail server for the inbox's e-mail alerts: smtp://user:pass@host:587, or smtps:// for TLS from the start. Needs GALLEY_MAIL_FROM.
GALLEY_MAIL_FROM—The sender address for those alerts. Needs GALLEY_SMTP_URL.
WORDPRESS_APP_PASSWORD—galley import wordpress --user: the WordPress application password, to read drafts and private pages (another variable with --app-password-env).

Link to this section: Plugins and adapters

VariableDefaultMeaning
GALLEY_ALLOW_SITE_PLUGINSoffHosted: 1 lets plugins and adapters a site's galley.config.json names run. Off on a shared server by default, because they are the site's own code.
GALLEY_DISABLE_SITE_PLUGINSoff1: never load plugins (or adapters) a site names.
GALLEY_DISABLE_SITE_ADAPTERSoff1: never load adapters a site names; use only the built-in ones.
GALLEY_DISABLE_USER_PLUGINSoff1: don't load the plugins added on this computer (<GALLEY_HOME>/plugins).

Link to this section: MCP

VariableDefaultMeaning
GALLEY_MCPonoff (or 0) removes the /mcp endpoint from a running server.
GALLEY_MCP_BUILDoff1: the /mcp endpoint works in build mode.
GALLEY_MCP_PUBLISHon0: the /mcp endpoint doesn't offer publishing.
GALLEY_MCP_TOKEN—Read by the configuration galley mcp config --http prints: the token from galley mcp token, kept in your tool's environment rather than its settings file.

Link to this section: White-label

VariableDefaultMeaning
GALLEY_BRAND_FILE—A JSON brand override — White-label.
GALLEY_BRAND_NAME—The product name shown in the app. Beats the brand file.
GALLEY_BRAND_ACCENT—The accent colour (hex). Beats the brand file.

Link to this section: The site kit

Read by the site kit in the site's own astro dev, not by Galley.

VariableDefaultMeaning
GALLEY_URLhttp://127.0.0.1:4400Where the kit's dev toolbar app finds Galley, to open the page you're on in it (The site kit).

Link to this section: The desktop app's self-test

For the desktop app's own test run, not for everyday use.

VariableDefaultMeaning
GALLEY_DESKTOP_SELFTEST—A page on another loopback port the app loads in its self-test.
GALLEY_DESKTOP_SELFTEST_OUT—Where the self-test writes its result.