[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationConfiguration

Configuration

How the CLI loads .env files, the secrets it needs and where they come from, and every environment variable the CLI and the frontend server read.

The CLI and the frontend server it starts read their configuration from the environment. Every command loads the project's .env files first, so a project keeps its configuration in a file instead of exporting variables by hand.

The .env files

Before it parses its options, every command loads .env.local, then .env, from the current working directory:

.env bash
DMS_API_BASE_URL=http://localhost:5010
DMS_CLIENT_BASE_URL=http://localhost:3001
DMS_BOOTSTRAP_SECRET=replace_with_a_strong_random_value
DMS_SESSION_SECRET=replace_with_at_least_32_characters
  • A variable already in the environment is never overwritten, so DMS_API_BASE_URL=… ajs dms build and a CI job's injected secrets win over a file left in the checkout. .env.local wins over .env.
  • A variable exported as an empty string counts as set.
  • Only the current directory is read. The CLI never reads a parent directory, and never the generated workspace, which gets its environment from the command that starts it.
  • The values reach the workspace build build starts and the servers dev and start run, which inherit the environment.
  • A missing file is not an error. An unreadable file is reported and skipped.
Warning

A DMS_API_BASE_URL line in .env counts as an explicit backend. ajs dms dev then stops discovering the backend from .antelope/dev.json and keys its workspace on that URL, so it no longer follows a development backend that lands on another port. Leave the variable out of .env to keep discovery for dev.

The secrets

SecretUsed byWhere it comes from
DMS_BOOTSTRAP_SECRETdev, prepare, and start to report the module versions it serves, sent as x-dms-bootstrapThe backend's frontend.bootstrapSecret. dev and prepare read the development credential from .antelope/dms-dev.json when they call the project's own backend. start takes only an explicit value. build needs none.
DMS_SESSION_SECRETThe frontend serverYou. It needs 32 characters or more, for example from openssl rand -hex 32. dev generates one per workspace when the variable is unset and keeps it across restarts, and start requires it.
DMS_HTML_RENDER_SECRETThe frontend server, to verify the backend's signed e-mail render requestsdev: the manifest, then the variable. start: the variable
DMS_OAUTH_RELAY_SECRETThe frontend server, presented to the backend's OAuth endpointsdev: the manifest, then the variable. start: the variable

Browser traffic never carries the bootstrap credential. The CLI presents it only to the backend's frontend manifest and to the ready report.

  • Prefer the variable to --bootstrap-secret, since a command line is visible to every process on the machine.
  • A credential that holds a space, a line break or a non-ASCII character is refused before any request, since it could not travel in a header.

Secrets the manifest publishes

The backend publishes htmlRender.serviceSecret and oauth.relaySecret in the manifest it serves to an authenticated caller:

CommandManifest source
devThe manifest it fetches.
startNone. A build keeps no private value, so set them in the server's environment.

The manifest value wins over a variable you set, which only fills in a secret the manifest leaves out. When several modules publish the same secret, the first in manifest-priority order wins, and a module that publishes another value is named in a warning.

Before the server starts, dev and start warn about each secret they do not have and what stops working without it. Once the server is ready, they list where the others came from, never their values. This is the line dev prints when the manifest holds both:

text
     Secrets:   DMS_HTML_RENDER_SECRET, DMS_OAUTH_RELAY_SECRET from the manifest

Session secret rules

dev and start use an explicit DMS_SESSION_SECRET as it is. Both refuse an empty or too-short value, so dev generates one only when the variable is not set at all:

text
$ DMS_SESSION_SECRET=short ajs dms start -b http://localhost:5050
✖ DMS_SESSION_SECRET is too short: 5 characters, at least 32 needed
  start signs sessions with it, so it must stay the same across restarts.
  → Create one: openssl rand -hex 32, then set it in the environment or ./.env

start never generates one, so a restart of a deployment cannot sign everyone out. The generated server checks the value again when it seals or reads a session cookie.

Server address and cookies

Variabledevstart
PORT (or -p)3001, moving to the next free port when in use3001, stopping when in use
HOST127.0.0.10.0.0.0
DMS_COOKIE_SECUREfalsetrue

Reverse proxies and additional routes

DMS_CLIENT_IP_HEADER, DMS_TRUSTED_PROXY_HOPS and DMS_COUNTRY_HEADER describe the reverse proxies in front of the server. See Security.

These variables add routes on top of those the modules declare:

VariableGuide
DMS_BACKEND_PROXIESRouting and the backend proxy
DMS_PUBLIC_ENDPOINTSPublic endpoints
DMS_AUTH_ESTABLISH_ENDPOINTSSessions and sign-in

Public dashboard URL

DMS_CLIENT_BASE_URL is the public URL of the dashboard, used in the links that e-mails carry. In e-mail renders, it overrides the public.dms.clientBaseUrl of the modules' public options.

Environment variables

This table is generated from the list ajs dms help environment prints. Run pnpm docs:reference in this repository after changing that list.

VariableWhat it sets
DMS_API_BASE_URLBackend URL, same as -b; clean ignores it
DMS_BOOTSTRAP_SECRETSame as --bootstrap-secret
DMS_SESSION_SECRETSession key, 32 characters or more; start needs one, dev makes one per workspace when unset
DMS_OFFLINESame as --offline, unless 0, false, no or off
DMS_WORKSPACE_DIRSame as build and start --workspace
ANTELOPEJS_LAUNCH_ENVAntelopeJS environment dev, build and start evaluate the project in, same as -e
DMS_PREPARE_STRICTSame as prepare --strict, read like DMS_OFFLINE
DMS_ENTRY_WEIGHT_WARNINGKB of Brotli a module may add to the client entry before build warns (default: 50; 0: never)
PORTSame as -p
HOSTAddress the server binds to (default: 127.0.0.1 for dev, 0.0.0.0 for start)
DMS_COOKIE_SECURESecure cookies unless false (default: false in dev, true in start)
NODE_ENVBuild of Vue and its libraries the server loads (default: development in dev, production in start)
DMS_CLIENT_IP_HEADERHeader the hosting platform overwrites with the client's address, e.g. X-Client-IP (default: none)
DMS_TRUSTED_PROXY_HOPSTrusted reverse-proxy hops, counted from the right (default: 0)
DMS_COUNTRY_HEADERProxy country header relayed to the backend when a proxy is trusted (default: CF-IPCountry; empty: none)
DMS_HTML_RENDER_SECRETE-mail render secret, the backend's htmlRender.serviceSecret; start needs it, a build keeps none
DMS_OAUTH_RELAY_SECRETOAuth relay secret the backend expects; start needs it, a build keeps none
DMS_PRIVATE_OPTIONSAny module's private options for start, as JSON by module id; a build keeps none
DMS_AUTH_ESTABLISH_ENDPOINTSMore backend endpoints /auth/establish may open a session from, comma-separated
DMS_PUBLIC_ENDPOINTSMore backend routes the proxy serves to anyone, as a JSON array
DMS_BACKEND_PROXIESMore backend prefixes the server proxies, as a JSON array of { path, auth? }
DMS_CLIENT_BASE_URLPublic frontend URL used in links and e-mails
NO_COLORSame as --no-color
ANTELOPEJS_VERBOSESame as --verbose
ANTELOPEJS_QUIETSame as -q, unless 0 or false
NO_UPDATE_NOTIFIER, CIEither one turns the update check off

In the terminal, ajs dms help environment prints the same list, followed by the .env rules this page describes.