Markdown Editor

Configuration Reference Template

Settings reference – precedence rules, file format, per-key type/default/range/env var/since, deprecations, validation

How to use: Use when a product has more than a handful of settings. State precedence first, then fill one complete row per key, ideally generated from the schema. The main pitfall is empty defaults and undocumented deprecated keys.

Preview

Configuration Reference: [Product name] [version]

Complete list of the settings that control [Product name], how they are loaded and how they are validated. Based on common industry practice for configuration reference documentation. Replace every [bracketed] value and every row marked Example.

FieldValue
Product version[4.2.0]
Configuration schema version[3]
Owner[@platform-team]
Status[Draft / Approved]
Last updatedYYYY-MM-DD

1. Sources and precedence

[Product name] reads configuration from four sources. When the same setting is defined in more than one place, the source higher in this list wins:

RankSourceExampleNotes
1 (highest)Command-line flag--server.port=9090Applies to this process only
2Environment variableAPP_SERVER_PORT=9090Prefix APP_, dots become underscores, upper case
3Configuration fileserver.port: 9090First file found, see 2
4 (lowest)Built-in default8080Listed in the tables below

To see the effective value and where it came from, run [app] config show --origin. Secrets are masked in the output.

2. File location and format

The first file found in this order is used; others are ignored:

  1. The path in --config or APP_CONFIG.
  2. ./app.yaml in the working directory.
  3. /etc/app/app.yaml (Windows: %ProgramData%\App\app.yaml).

YAML 1.2 and TOML 1.0 are supported; the format is chosen from the file extension. Unknown keys are rejected so that typos are not silently ignored. A complete example with defaults:

schema_version: 3
server:
  host: 0.0.0.0
  port: 8080
  request_timeout: 30s
database:
  url: ${DATABASE_URL}
  max_connections: 20
cache:
  enabled: true
  ttl: 5m
logging:
  level: info
  format: json

${NAME} is replaced with the value of environment variable NAME at load time; a missing variable is a validation error.

3. Value types

TypeFormatExamples
stringUTF-8 text"eu-west-1"
integerWhole number, optional _ separators20, 10_000
booleantrue or false (also 1/0 in environment variables)true
durationNumber with unit ms, s, m, h500ms, 30s, 5m
sizeNumber with unit B, KB, MB, GB (base 1024)64MB
enumOne of the listed values, case-sensitiveinfo
secretString that is masked in logs and output${DATABASE_URL}

4. Settings

4.1 server

KeyTypeDefaultAllowed valuesEnvironment variableDescriptionSince
server.hoststring0.0.0.0IPv4 or IPv6 addressAPP_SERVER_HOSTInterface to listen on1.0
server.portinteger80801 to 65535APP_SERVER_PORTTCP port for HTTP traffic1.0
server.request_timeoutduration30s1s to 10mAPP_SERVER_REQUEST_TIMEOUTMaximum time to handle one request2.1
server.max_body_sizesize10MB1KB to 1GBAPP_SERVER_MAX_BODY_SIZELargest accepted request body3.0

4.2 database

KeyTypeDefaultAllowed valuesEnvironment variableDescriptionSince
database.urlsecretnone (required)postgres:// URLAPP_DATABASE_URLConnection string including credentials1.0
database.max_connectionsinteger201 to 500APP_DATABASE_MAX_CONNECTIONSPool size per process1.0
database.statement_timeoutduration15s100ms to 5mAPP_DATABASE_STATEMENT_TIMEOUTCancels slower queries3.2

4.3 cache

KeyTypeDefaultAllowed valuesEnvironment variableDescriptionSince
cache.enabledbooleantruetrue, falseAPP_CACHE_ENABLEDTurns the response cache on or off2.0
cache.ttlduration5m0s to 24hAPP_CACHE_TTLTime an entry stays valid; 0s disables expiry2.0
cache.max_sizesize256MB16MB to 16GBAPP_CACHE_MAX_SIZEMemory limit for the cache4.0

4.4 logging

KeyTypeDefaultAllowed valuesEnvironment variableDescriptionSince
logging.levelenuminfodebug, info, warn, errorAPP_LOGGING_LEVELMinimum severity written1.0
logging.formatenumjsonjson, textAPP_LOGGING_FORMATOutput format1.4
[key][type][default][allowed][ENV_VAR][Description][x.y]

5. Changes at runtime

Settings marked with a reload flag in config show --origin can be changed without restarting: edit the file and send SIGHUP or call POST /admin/reload. Currently reloadable: logging.level, cache.ttl, server.request_timeout. All other changes need a restart.

6. Deprecated and removed settings

KeyStatusReplacementDeprecated inRemoved inBehaviour now
db.poolRemoveddatabase.max_connections2.04.0Startup error
server.timeoutDeprecatedserver.request_timeout3.0[5.0]Value used, warning logged
cache.size_mbDeprecatedcache.max_size4.0[5.0]Converted, warning logged
[old key][Deprecated / Removed][new key][x.y][x.y][Behaviour]

7. Validation

Configuration is validated at startup and on every reload. An invalid configuration stops startup; an invalid reload is rejected and the running configuration stays in place. Run the same checks before deploying:

app config validate --config ./app.yaml

Checks performed:

  • Every key is known for the declared schema_version.
  • Every value has the right type and is inside its allowed range.
  • Required settings without defaults are present.
  • Referenced environment variables exist.
  • Cross-field rules hold, for example database.max_connections×instances≤\text{database.max\_connections} \times \text{instances} \le the database server's connection limit (checked when --instances is given).

Example error output (exit status 2):

app.yaml:7:20 database.max_connections: 900 is above the maximum of 500
app.yaml:12:10 logging.level: "verbose" is not one of debug, info, warn, error

8. Related documents

  • [Installation Guide]: where the file is created during setup.
  • [Administrator Guide]: recommended production values and tuning.
  • [Changelog]: settings added, changed or deprecated per release.

Standard and licence note

Based on common industry practice for configuration reference documentation, including layered precedence of flags, environment variables, files and defaults. Template licence: MIT.

Related templates