Precedence
How dbmcp picks each setting from the environment, env files, config files, and defaults
Each setting is resolved on its own, highest priority first:
- Process environment —
DBMCP_*variables, typically set by the MCP client (viaenvorenvFilein the server config) - Env files —
DBMCP_*keys in the files named by--env-file/DBMCP_ENV_FILE; a later file wins - Config files — keys in the YAML files named by
--config-file/DBMCP_CONFIG_FILE; a later file wins - Built-in defaults — backend-aware defaults (see Backend defaults)
When the same setting is set in multiple places, the higher-priority source wins. An empty DBMCP_* value counts as unset at every layer, so it falls through to the next source; to set a setting to an empty string, use key: "" in the YAML file. Unknown DBMCP_* variables are ignored.
Worked example. database.port set in three layers:
# /srv/dbmcp/dbmcp.yaml
database:
backend: postgres
port: 5432# /srv/dbmcp/dbmcp.env
DBMCP_DB_PORT=6432DBMCP_DB_PORT=7432 dbmcp --config-file /srv/dbmcp/dbmcp.yaml --env-file /srv/dbmcp/dbmcp.env| Change | Resulting port | Source |
|---|---|---|
| All three layers set | 7432 | process environment |
Process variable unset, or DBMCP_DB_PORT= (empty) | 6432 | env file |
| Env file line removed as well | 5432 | config file |
port removed from the YAML too | 5432 | PostgreSQL backend default |