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:
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 buildand a CI job's injected secrets win over a file left in the checkout..env.localwins 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
buildstarts and the serversdevandstartrun, which inherit the environment. - A missing file is not an error. An unreadable file is reported and skipped.
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
| Secret | Used by | Where it comes from |
|---|---|---|
DMS_BOOTSTRAP_SECRET | dev, prepare, and start to report the module versions it serves, sent as x-dms-bootstrap | The 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_SECRET | The frontend server | You. 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_SECRET | The frontend server, to verify the backend's signed e-mail render requests | dev: the manifest, then the variable. start: the variable |
DMS_OAUTH_RELAY_SECRET | The frontend server, presented to the backend's OAuth endpoints | dev: 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:
| Command | Manifest source |
|---|---|
dev | The manifest it fetches. |
start | None. 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:
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:
$ 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
| Variable | dev | start |
|---|---|---|
PORT (or -p) | 3001, moving to the next free port when in use | 3001, stopping when in use |
HOST | 127.0.0.1 | 0.0.0.0 |
DMS_COOKIE_SECURE | false | true |
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:
| Variable | Guide |
|---|---|
DMS_BACKEND_PROXIES | Routing and the backend proxy |
DMS_PUBLIC_ENDPOINTS | Public endpoints |
DMS_AUTH_ESTABLISH_ENDPOINTS | Sessions 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.
| Variable | What it sets |
|---|---|
DMS_API_BASE_URL | Backend URL, same as -b; clean ignores it |
DMS_BOOTSTRAP_SECRET | Same as --bootstrap-secret |
DMS_SESSION_SECRET | Session key, 32 characters or more; start needs one, dev makes one per workspace when unset |
DMS_OFFLINE | Same as --offline, unless 0, false, no or off |
DMS_WORKSPACE_DIR | Same as build and start --workspace |
ANTELOPEJS_LAUNCH_ENV | AntelopeJS environment dev, build and start evaluate the project in, same as -e |
DMS_PREPARE_STRICT | Same as prepare --strict, read like DMS_OFFLINE |
DMS_ENTRY_WEIGHT_WARNING | KB of Brotli a module may add to the client entry before build warns (default: 50; 0: never) |
PORT | Same as -p |
HOST | Address the server binds to (default: 127.0.0.1 for dev, 0.0.0.0 for start) |
DMS_COOKIE_SECURE | Secure cookies unless false (default: false in dev, true in start) |
NODE_ENV | Build of Vue and its libraries the server loads (default: development in dev, production in start) |
DMS_CLIENT_IP_HEADER | Header the hosting platform overwrites with the client's address, e.g. X-Client-IP (default: none) |
DMS_TRUSTED_PROXY_HOPS | Trusted reverse-proxy hops, counted from the right (default: 0) |
DMS_COUNTRY_HEADER | Proxy country header relayed to the backend when a proxy is trusted (default: CF-IPCountry; empty: none) |
DMS_HTML_RENDER_SECRET | E-mail render secret, the backend's htmlRender.serviceSecret; start needs it, a build keeps none |
DMS_OAUTH_RELAY_SECRET | OAuth relay secret the backend expects; start needs it, a build keeps none |
DMS_PRIVATE_OPTIONS | Any module's private options for start, as JSON by module id; a build keeps none |
DMS_AUTH_ESTABLISH_ENDPOINTS | More backend endpoints /auth/establish may open a session from, comma-separated |
DMS_PUBLIC_ENDPOINTS | More backend routes the proxy serves to anyone, as a JSON array |
DMS_BACKEND_PROXIES | More backend prefixes the server proxies, as a JSON array of { path, auth? } |
DMS_CLIENT_BASE_URL | Public frontend URL used in links and e-mails |
NO_COLOR | Same as --no-color |
ANTELOPEJS_VERBOSE | Same as --verbose |
ANTELOPEJS_QUIET | Same as -q, unless 0 or false |
NO_UPDATE_NOTIFIER, CI | Either 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.