Configuration
Every setting is an environment variable. Most of them can also be stored in the database and changed at runtime.
Where settings come from
Precedence, from lowest to highest:
- the default
- the value stored in the database (
<AUTH_PREFIX>configuration, persistent settings only) - the programmatic value:
server.configof the Nuxt module,configofcreateMongocampServer - the environment variable
Persistent settings can be changed at runtime with PATCH /system/configurations/{key}. The value is checked against the type of the setting. A setting that is set by the environment cannot be changed that way (400). Environment values are not written into the database. DELETE /system/configurations/{key} (2.6) sets the default again, at once for a setting that needs no restart; not for AUTH_SECRET (its default is generated).
GET /system/configurations lists all settings with their effective value, type and whether a change needs a restart. CONNECTION_PASSWORD and AUTH_SECRET are answered as ********.
Since 2.8 every entry also says where its value comes from and whether it is the current default:
| Field | Meaning |
|---|---|
source | env (environment variable), option (programmatic value), patched (set with PATCH), stored (stored, but nobody set it — the default a first start wrote, possibly the default of an older server), default (nothing stored, or not persistent) |
defaultValue | The current default in the form of value. Left out for AUTH_SECRET (generated); masked like value for secrets |
isDefault | value equals the current default (lists in the same order, numbers by value) |
After an upgrade
The server stores every persistent default at the first start of a database, and a stored value wins over a newer default. A few known old defaults are replaced at the start (AUTH_GRANT_DENIED_STATUS, CORS_HEADERS_EXPOSED, AGGREGATION_STAGES_DENIED, DOCS_SWAGGER). For everything else:
- the start logs one warning with the keys whose stored value nobody set and that differ from the current default (keys only, no values);
GET /system/configurationsshows the same entries assource: "stored"withisDefault: false;DELETE /system/configurations/{key}takes the current default,PATCHkeeps the value (it is thenpatchedand no longer reported).
An environment variable or a programmatic value hides the stored value, so it is not reported. 3.0 is planned to stop storing defaults at all.
Value formats
| Type | Environment format | Example |
|---|---|---|
| String | text | CONNECTION_DATABASE=shop |
| Long | whole number | SERVER_PORT=9000 |
| Boolean | true / false | DOCS_SWAGGER=true |
| Duration | number with unit (ms, s, m, h, d, or words like hours) | AUTH_EXPIRING_DURATION=12h |
| List | JSON array, or comma separated | CORS_ORIGINS_ALLOWED='["https://app.example.com"]' |
$ in lists
Quote values with $ for the shell: AGGREGATION_STAGES_DENIED='["$function","$out"]'.
Connection
Not persistent: these are needed before the database is reachable. A restart is required to change them.
| Setting | Default | Description |
|---|---|---|
CONNECTION_HOST | localhost | MongoDB host |
CONNECTION_PORT | 27017 | MongoDB port |
CONNECTION_DATABASE | mongocamp | Default database: collections without a db: prefix live here, and so do the mc_* collections |
CONNECTION_USERNAME | — | Database user |
CONNECTION_PASSWORD | — | Password of the database user |
CONNECTION_AUTHDB | admin | Authentication database |
A full connection string (connectionUri, or NUXT_MONGOCAMP_SERVER_CONNECTION_URI for the Nuxt module) replaces host, port and credentials.
Auth
| Setting | Default | Persistent | Description |
|---|---|---|---|
AUTH_PREFIX | mc_ | no | Prefix of the server's collections (mc_users, mc_roles, mc_token_cache, mc_configuration, mc_jobs, ...) |
AUTH_HANDLER | mongo | yes, restart | mongo: users and roles in the database. static: from AUTH_USERS / AUTH_ROLES |
AUTH_USERS | ["{}"] (none) | no | Users of the static handler, see Authentication |
AUTH_ROLES | ["{}"] (none) | no | Roles of the static handler |
AUTH_SECRET | random, stored | yes | Secret that signs the tokens. Generated at the first start and stored, so all instances and restarts share it |
AUTH_EXPIRING_DURATION | 6h | yes | Lifetime of a token |
AUTH_REFRESH_GRACE_DURATION | 60s | yes | How long a token stays valid after /auth/token/refresh replaced it |
AUTH_CACHE_DB | true | yes | Keeps tokens (as SHA-256) in mc_token_cache so they survive restarts and are shared between instances |
AUTH_APIKEYLENGTH | 32 | yes | Length of generated API keys |
AUTH_GRANT_DENIED_STATUS | 403 | yes | Status for a logged-in user without the grant: 403, or 401 (clients clear the session on it). Since 2.6 a 401 that a database before 2.2 stored as default becomes 403 at the start; a patched 401 stays |
AUTH_BEARER | true | yes, restart | Accept bearer tokens |
AUTH_BASIC | true | yes, restart | Accept Basic auth |
AUTH_TOKEN | true | yes, restart | Accept API keys (X-AUTH-APIKEY) |
Server and CORS
| Setting | Default | Description |
|---|---|---|
SERVER_INTERFACE | 0.0.0.0 | Listener of the standalone server (restart) |
SERVER_PORT | 8080 | Port of the standalone server (restart) |
CORS_ORIGINS_ALLOWED | ["http://localhost:8080"] | Allowed origins. An allowed origin is answered with credentials and Vary: Origin; another origin gets no Access-Control-Allow-Origin (2.5); an empty list allows any origin with * and without credentials |
CORS_HEADERS_ALLOWED | ["Authorization", "Content-Type", "X-Requested-With", "X-AUTH-APIKEY"] | Access-Control-Allow-Headers |
CORS_HEADERS_EXPOSED | ["Content-Type", "x-pagination-rows-per-page", "x-pagination-current-page", "x-pagination-count-rows", "x-pagination-count-pages", "x-pagination-next", "x-request-id", "x-export-max-documents"] | Access-Control-Expose-Headers. Since 2.7.1 an older default that a database stored at its first start (without x-pagination-next or x-export-max-documents) becomes this list at the start; a patched list stays |
DOCS_OPENAPI | true | Serve the spec at /docs/docs.yaml (restart) |
DOCS_SWAGGER | false | Serve the Scalar API reference at /docs (restart). Since 2.7.2 a true that the Scala server stored as default becomes false at the start; a patched true stays |
SERVER_HEADER_ENABLED | true | Send the server header with name and version (2.5) |
ERRORS_EXPOSE_INTERNAL | false | Answer the message of an unexpected error (500) instead of a generic one; for development (2.5). The log always has it |
USERS_READ_HIDE_API_KEY | true (3.0; false in 2.x) | The document routes (list, find, search, get, export, aggregate, distinct, expand) leave out apiKey of mc_users, like password (2.6). The admin user routes keep it. false keeps the 2.x answers |
Documents and filters
| Setting | Default | Description |
|---|---|---|
AGGREGATION_STAGES_DENIED | ["$function", "$accumulator", "$where", "$out", "$merge", "$currentOp", "$listSessions", "$collStats", "$indexStats"] | Operators refused anywhere in an aggregation pipeline. See Aggregation. Since 2.7.2 the Scala server's stored default (without $collStats and $indexStats) becomes this list at the start; a patched list stays |
FILTER_TIME_ZONE | UTC | Time zone of dates without a zone in Lucene filters: an IANA name (Europe/Berlin) or an offset (+05:30) |
IMPORT_MAX_BYTES | 1073741824 (1 GiB) | Largest body of an import, read for every request |
WATCH_MAX_STREAMS | 100 | Open live updates of one instance (each holds a change stream); 503 beyond |
DOCUMENTS_CHECK_FIELD_NAMES | true (3.2) | Field names that start with $ (at any depth) or contain . (at the top level) are refused with 400 (code 4010, the paths in issues): inserts, many/insert, imports, replaces and the values of $set, $setOnInsert, $push, $addToSet. Dotted and positional update paths and $/. in values stay allowed; hooks and driver writes are not checked. checkFieldNames of a declaration wins. false stores such names as before |
FILTER_OPERATORS_DENIED | ["$where", "$function", "$accumulator"] | Operators refused anywhere in the filters, projections and updates of clients and server code (403, code 4031, 2.5). An empty list allows them |
Limits
Since 2.5. 0 means no limit. BODY_MAX_BYTES and WATCH_QUEUE_MAX are on by default, the others are opt-in. See the production checklist. Since 2.6 every user can read them in /system/capabilities (limits), and each 413 has its own code (4131 body, 4132 upload, 4133 import).
| Setting | Default | Description |
|---|---|---|
BODY_MAX_BYTES | 67108864 (64 MiB) | Largest JSON body of a request; 413 beyond (the import has IMPORT_MAX_BYTES) |
PAGING_MAX_ROWS | 0 | Largest rowsPerPage of document reads and (2.6) the file lists of buckets; a larger value reads this many, the pagination headers show it |
EXPORT_MAX_DOCUMENTS | 0 | Most documents of one export, with or without limit; a capped export says so (2.6, end marker, header x-export-max-documents) |
GRIDFS_UPLOAD_MAX_BYTES | 0 | Largest file of an upload; 413 beyond, the partial file is removed |
WATCH_QUEUE_MAX | 1000 | Changes waiting for a slow live-update client; beyond, it gets reset and the stream ends (the client loads again and reconnects) |
EXPORT_CSV_ESCAPE_FORMULAS | false | A csv cell that a spreadsheet would run as a formula (=, +, -, @, tab, CR) gets a leading ' |
Files
| Setting | Default | Description |
|---|---|---|
FILE_HANDLER | gridfs | Only gridfs is supported (restart) |
FILE_CACHE_AGE | 7776000 | max-age (seconds) of the cache-control header of downloads |
Request logging and metrics
Off by default. A restart is required after a change. How the features are switched on per host is in Request Logging & Metrics.
| Setting | Default | Description |
|---|---|---|
REQUESTLOGGING_ENABLED | false | Standalone server: writes every request as a document into <AUTH_PREFIX>request_logging. Embedded: not read, see Switching the features on |
METRICS_ENABLED | false | Standalone server: enables /system/monitoring/* (including Prometheus text). Embedded: not read, as above |
METRICS_MONGODB_DATABASE | false | Database statistics |
METRICS_MONGODB_COLLECTIONS | [] | Collections with statistics |
METRICS_MONGODB_CONNECTIONS, METRICS_MONGODB_NETWORK, METRICS_MONGODB_OPERATION, METRICS_MONGODB_SERVER, METRICS_MONGODB_COMMAND, METRICS_MONGODB_CONNECTIONPOOL | false | MongoDB metric groups |
LOGGING_METRICS_MONGODB_STEP | 60m | Interval of the metric snapshots |
LOGGING_METRICS_MONGODB_RUNTIME, LOGGING_METRICS_MONGODB_SYSTEM, LOGGING_METRICS_MONGODB_MONGO, LOGGING_METRICS_MONGODB_EVENT | false | Write snapshots of a category into monitoring_* |
Jobs
| Setting | Default | Description |
|---|---|---|
JOBS_ENABLED | true | Not persistent, restart. false: this instance does not run the jobs on their schedule, but still lists them and runs them by request. Use it so that only one of several instances runs the jobs. |
Migrations, seeds, files and operations (2.11)
| Setting | Default | Persistent | Description |
|---|---|---|---|
MIGRATIONS_ON_START | run | no | run applies pending migrations at the start, check refuses to start with pending ones, off only registers them |
SEED_ON_START | false (the module: true in development) | no | Upsert the seeds at the start |
FILE_LINK_MAX_DURATION | 7d | yes | Longest lifetime of a signed file link |
OTEL_ENABLED | false | no | Command monitoring for the tracing; the standalone server switches tracing() on and exports over OTLP |
OTEL_HASH_USER_ID | true | yes, restart | The user id of a span as SHA-256 (16 hex digits) |
RATE_LIMIT_LOGIN | 10/15m (3.0; 2.x: empty, off) | yes | Failed logins (/auth/login, Basic auth) per user and address, like 10/15m; then 429 with Retry-After; empty switches it off |
RATE_LIMIT_REQUESTS | empty (off) | yes | Requests per verified user, like 600/1m; requests without credentials, and those whose credentials fail, count for their address (3.0: unverified credentials no longer pick the counter) |
RATE_LIMIT_STORE | memory | yes, restart | memory per instance, mongo shared by the instances (mc_rate_limits, TTL) |
RATE_LIMIT_TRUSTED_PROXIES | [] | yes | Addresses of proxies whose X-Forwarded-For is read for the client address |
BACKUP_COLLECTIONS | [] (declared and mc_*) | yes | Collections of a backup |
BACKUP_DIRECTORY | — (bucket mc_backups) | yes | Directory for the backups instead of the bucket |
BACKUP_RETENTION | 7 | yes | Backups that are kept (newest) |
AUTH_SESSIONS | false | yes, restart | 3.0: sessions with rotating refresh tokens (httpOnly cookie) |
AUTH_SESSION_DURATION | 30d | yes | 3.0: lifetime of a session |
AUTH_REGISTRATION | off | yes, restart | 3.0: open or invite self-registration |
AUTH_REGISTRATION_ROLES | [] | yes | 3.0: roles of an open registration |
AUTH_REQUIRE_VERIFIED_EMAIL | false | yes | 3.0: no login with an unverified address |
AUTH_PASSWORD_RESET | false | yes, restart | 3.0: password reset by mail |
AUTH_PASSWORD_MIN_LENGTH | 8 | yes | 3.0: registration and reset |
AUTH_APP_URL | empty (origin of the request) | yes | 3.0: base of the links in the mails |
AUTH_VERIFY_DURATION, AUTH_RESET_DURATION, AUTH_INVITE_DURATION | 24h, 1h, 7d | yes | 3.0: lifetime of the tokens |
AUTH_PASSWORDLESS | false | yes, restart | 3.0: login by link or code |
AUTH_PASSWORDLESS_DURATION | 15m | yes | 3.0: lifetime of a login link |
QUEUE_WORKER | true | yes | 3.0: this instance works on the job queue (when it has handlers) |
QUEUE_CONCURRENCY | 1 | yes | 3.0: jobs at once per instance |
QUEUE_LEASE | 60s | yes | 3.0: lease of a claimed job, renewed while it runs |
QUEUE_POLL_INTERVAL | 1s | yes | 3.0: how often an idle worker looks for due jobs |
QUEUE_KEEP_DONE | 7d | yes, restart | 3.0: done jobs are removed after this time |
WEBHOOKS_ALLOW_PRIVATE | false | yes | 3.0: webhooks may call internal addresses |
WEBHOOKS_DISABLE_AFTER | 10 | yes | 3.0: failed deliveries in a row before a webhook is switched off (0: never) |
WEBHOOKS_TIMEOUT | 10s | yes | 3.0: time for the answer of a receiver |
OUTBOX_INTERVAL | 30s | yes, restart | 3.0: how often the outbox of transactions is checked for events a stopped server did not publish |
MCP_MAX_ROWS | 100 | yes | 3.0: documents per answer of the MCP endpoint |
MCP_MAX_BYTES | 100000 | yes | 3.0: text per answer of the MCP endpoint |
RESPONSE_COMPRESSION | false | yes | 3.0: gzip (or deflate) of JSON, YAML, text, CSV and NDJSON answers when the request accepts it; streams are compressed as they are read. A large page shrinks about 14 times at no measurable cost; leave it off behind a proxy that compresses |
Migration
| Setting | Default | Description |
|---|---|---|
MIGRATION_DROP_SCALA_LEFTOVERS | false | Not persistent. Set it for one start when upgrading the database of an older MongoCamp server; what it changes is described in Migration to 2.0. Running it again changes nothing. |
