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~/.galley (/data in the image)The Galley home: the sites list, settings, keys, conversations, the inbox, per-site state. The CLI and the desktop app share it when they share this value. On a hosted install it is the data folder: the one site and everything the install keeps (Run a hosted install). Settings and secrets.
GALLEY_SITES_DIR<GALLEY_HOME>/sitesWhere cloned and new sites go. Ignored on a hosted install, which keeps its one site in its data folder (it says so at start-up).
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 a hosted install. 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); on a hosted install and for the desktop app it is an error.
GALLEY_PUBLIC_URL—Hosted: the address people use, e.g. https://cms.example.com. Used for the Host and Origin checks, the preview's and live comparison's addresses, the forms' capture address and the MCP endpoint, and every invitation and new-password link is built from it. Without it the server answers any hostname, there is no preview, no link is e-mailed, and a link can be made only from a loopback address. Set it before inviting anyone.
GALLEY_TRUST_PROXYoff1: honour X-Forwarded-Proto and X-Forwarded-For from a reverse proxy you control. Every limit counts a client by the address this gives: an IPv4 address, or a whole IPv6 /64. Without it, behind a proxy, everyone is one client; with it and no proxy in front, a request can claim any address, so set it only behind a proxy of your own.
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, which then reach every route except a person's own account, People, backups, restore and opening the preview, and on /mcp; what it does is the operator's, so it may publish and change the site's settings. 16 characters or more. On a hosted install the site's own commands never see it.
GALLEY_PREVIEW_PORTSany free portOn your own computer: a port range for the previews and their proxies, e.g. 4410-4429. Ignored on a hosted install, which serves the preview through its one port by hostname (it says so at start-up).
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: A hosted install

Read by galley serve. The ones marked starting value are used once, only while the install doesn't have that thing yet, so what someone later changes in the app sticks across restarts (Run a hosted install). Secrets among them are never passed to the site's own commands.

VariableDefaultMeaning
GALLEY_PREVIEW_URLworked out from GALLEY_PUBLIC_URLWhere the preview is served, on the same port, by hostname: cms.example.com gives https://cms-preview.example.com; a two-part name or *.localhost gives preview.<name>.
GALLEY_LIVE_VIEW_URLworked out the same wayWhere the live site is shown beside the preview: https://cms-live.example.com.
GALLEY_PASSWORD—Starting value. The first owner's password, 12 characters or more, used only while there is no owner. Without it the server prints a one-time setup link. Never put back by --reset-password, and ignored with a notice once the owner has changed their password.
GALLEY_OWNER_NAME—Starting value. The first owner's name, with GALLEY_PASSWORD (without it, ignored with a notice). Also fills in the name of an owner carried over from before accounts, once.
GALLEY_OWNER_EMAIL—Starting value. The e-mail the first owner signs in with, with GALLEY_PASSWORD. Without these two the owner has no name or e-mail yet, and the app asks for them after sign-in.
GALLEY_SETUP_TOKENa code is made and printedThe one-time setup code to use instead, 24 characters or more. Not printed again at start-up. Once used, it stays dead: whenever a setup link is needed again, a fresh one is made instead.
GALLEY_SETUP_TOKEN_SHA256—Only the setup code's SHA-256 (64 hexadecimal characters), so the code itself never reaches the server.
GALLEY_INSTALL_CONFIG—One JSON file with any of the starting values (its shape). The environment wins over it. Make it readable by the server's user only.
GALLEY_SITE_REPOSITORY—Starting value. The site's repository: git@github.com:example/site.git or https://….
GALLEY_SITE_ACCESSdeploy-key (token when GALLEY_SITE_TOKEN is set)How the repository is reached: the install's own deploy key, or an access token over HTTPS.
GALLEY_SITE_TOKEN—Starting value. The access token, with GALLEY_SITE_ACCESS=token. Kept in the data folder's key store, never in the checkout or the address.
GALLEY_SITE_BRANCHthe repository's default branchStarting value. The branch to work on.
GALLEY_SITE_FOLDERthe top of the repositoryStarting value. The folder inside the repository that holds the site, e.g. apps/site.
GALLEY_SITE_STARTER—Starting value. Send this starter to an empty repository as its first version, instead of copying what it holds.
GALLEY_SITE_LIVE_URL—Starting value. The site's live address, which Proof compares against. Kept in the install's own state, never written into the site; the site's own urls.production wins when it has one.
GALLEY_AUTHOR_NAME—Starting value. The install's publishing name: what a publish nobody signed in started (a script, an AI tool over MCP) is recorded with. A signed-in person publishes under their own name. Needs GALLEY_AUTHOR_EMAIL.
GALLEY_AUTHOR_EMAIL—Starting value. The install's publishing e-mail, with GALLEY_AUTHOR_NAME.
GALLEY_SITE_DIR—Upgrading a data folder from before single-site installs that holds several sites: which site's folder to keep. Without it such a folder is refused at start-up, in one sentence.
GALLEY_ALLOW_LOCAL_REPOSITORIESoff1: the repository may be a folder on the server itself (trials). Off because it would let the editor read any repository on the server's disk.
GALLEY_PREVIEW_MEMORY_MBno limitNode's memory ceiling (its max-old-space-size option) for the site's own preview, build and install commands, added after any NODE_OPTIONS of yours. Never applied to the server's own process. The generated files set 1024.
GALLEY_LOG_REQUESTSon0 leaves out the one log line per request (method, path without the query, status, time).
GALLEY_SHUTDOWN_GRACE_MS20000How long stopping waits for a publish or a connect in progress.
GALLEY_SYNC_MINUTES5How often the editor looks for newer versions in the site's repository and, when nothing here is in the way, brings them in (forward only, as Get latest does). 0 turns the rounds off; Version history still looks when it opens. Whole minutes, up to 1440. Ignored on your own computer, which never looks by itself (Keeping up with the repository).
GALLEY_RESTORE_MAX_MB2048The largest backup the Install page's restore takes. Restore larger ones with galley backup restore.
GALLEY_BACKUP_PASSPHRASEasked on a terminalThe passphrase for galley backup create and galley backup restore, 12 characters or more. Pass it into a one-off container with -e GALLEY_BACKUP_PASSPHRASE (Back it up).

Link to this section: Hosting the editor online

Read by the app on your own computer for Host the editor online and galley host (Host the editor online).

VariableDefaultMeaning
FLY_API_TOKEN—The Fly.io organization token. Beats the one saved in the app.
GOOGLE_APPLICATION_CREDENTIALS_JSON—The whole text of a key file from Google Cloud (a service account's JSON key), for the Google Cloud host — not its path. Beats the one saved in the app.
GALLEY_HOSTING_IMAGEghcr.io/fictiontribe/galley:<version>The image a new or upgraded install runs. That default isn't published yet, so set this to an image you built and pushed.
GALLEY_HOSTING_<NAME>_APIthe host's own APITesting only: send a host's API calls (FLY, CLOUDFLARE, and Google Cloud's GCP_COMPUTE, GCP_OAUTH, GCP_RESOURCE_MANAGER) to a fake host.
GALLEY_HOSTING_INSTALL_APIhttps://<editor address>Testing only: where a new install is reached, for a rehearsal against fake hosts.

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_DEPLOY_PROBEthe domain itself, over HTTPSTesting only: where Galley looks to see whether a site's own domain answers yet. A URL with {host} in it.
GALLEY_REDIRECTS_CLOUDFLARE_APIhttps://api.cloudflare.com/client/v4Testing only: the API address for setting redirects on Cloudflare.

Link to this section: Media in a bucket

VariableDefaultMeaning
GALLEY_MEDIA_ACCESS_KEY_ID—The bucket key's Access Key ID, for every site that has none of its own. A site's own key beats it. Media in a bucket.
GALLEY_MEDIA_SECRET_ACCESS_KEY—The same key's Secret Access Key.
GALLEY_MEDIA_IMAGES_TOKEN—The Cloudflare API token for Cloudflare Images (Account › Cloudflare Images › Edit), for every site that has none of its own.
GALLEY_MEDIA_IMAGES_APIhttps://api.cloudflare.com/client/v4Testing only: send Cloudflare Images API calls to another address (a stand-in).

Link to this section: Forms and e-mail

VariableDefaultMeaning
GALLEY_SMTP_URL—The mail server for the inbox's e-mail alerts and, on a hosted install, for invitations, new-password links and Forgot your password? (Outgoing e-mail): smtp://user:pass@host:587, or smtps:// for TLS from the start. Needs GALLEY_MAIL_FROM; links are e-mailed only when GALLEY_PUBLIC_URL is set too.
GALLEY_MAIL_FROM—The sender address for those e-mails. 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. In the editing app it is the built-in themes' pencil, checked for legibility like any pencil; one too close to grey is not used there, and the server says so when it starts (themes).

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.