Skip to main content

Configuration reference

The server reads YAML, environment variables, or both. Higher-priority sources override lower-priority sources:

environment variable > configuration file > built-in default

Pass a file explicitly:

fhir-server --config /etc/fhir-server/config.yaml

Or set:

FHIR_SERVER_CONFIG=/etc/fhir-server/config.yaml fhir-server

Unknown keys, invalid values, and an explicitly configured missing file fail startup.

Example​

server:
port: 9090
baseUrl: http://localhost:9090/fhir/r4
readTimeout: 30s
writeTimeout: 60s
idleTimeout: 120s

logging:
level: info

database:
# local development only - use unique credentials and TLS (sslmode=require or
# stricter) in any shared or production environment
url: postgres://fhir:fhir@localhost:5432/fhirdb?sslmode=disable
createTables: false
planCacheMode: force_custom_plan

search:
probeCap: 5000
defaultPageSize: 20
maxPageSize: 200
maxChainDepth: 5

write:
maxRowsPerStatement: 1000
maxRowsPerBundle: 100000

searchParams:
watch: false

ig:
packages:
- hl7.fhir.us.core@6.1.0
registryUrl: https://packages.fhir.org
forceReload: false
cacheDir: .fhir-ig-cache

Server and logging​

YAML keyEnvironment variableDefault
server.portSERVER_PORT9090
server.baseUrlBASE_URLhttp://localhost:{port}/fhir/r4
server.readTimeoutSERVER_READ_TIMEOUT30s
server.writeTimeoutSERVER_WRITE_TIMEOUT60s
server.idleTimeoutSERVER_IDLE_TIMEOUT120s
server.maxRequestBodyBytesSERVER_MAX_REQUEST_BODY_BYTES209715200 (200 MiB)
logging.levelLOG_LEVELinfo

A request whose body exceeds server.maxRequestBodyBytes is rejected with 413 Request Entity Too Large before being read into memory. Valid range: 1 MiB to 2 GiB. Raise it for deployments that accept very large transaction Bundles.

Database​

YAML keyEnvironment variableDefault
database.urlDATABASE_URLDerived from individual fields
database.hostDB_HOSTlocalhost
database.portDB_PORT5432
database.userDB_USERfhir
database.passwordDB_PASSWORDfhir
database.nameDB_NAMEfhirdb
database.createTablesFHIR_CREATE_TABLESfalse
database.planCacheModeDATABASE_PLAN_CACHE_MODEforce_custom_plan

When database.url is set, it overrides the individual database fields.

warning

database.planCacheMode is load-bearing. force_custom_plan makes PostgreSQL re-plan every search with its actual parameter values, which is what keeps skewed parameters (a common code versus a rare one) from being served by a single cached generic plan. Setting it to auto or force_generic_plan re-exposes exactly the misestimate pathology the search architecture is designed to avoid — change it only for controlled experiments. See Performance tuning.

Search and write path​

YAML keyEnvironment variableDefault
search.probeCapSEARCH_PROBE_CAP5000
search.defaultPageSizeSEARCH_DEFAULT_PAGE_SIZE20
search.maxPageSizeSEARCH_MAX_PAGE_SIZE0
search.maxChainDepthSEARCH_MAX_CHAIN_DEPTH5
write.maxRowsPerStatementWRITE_MAX_ROWS_PER_STATEMENT1000
write.maxRowsPerBundleWRITE_MAX_ROWS_PER_BUNDLE100000

search.maxPageSize=0 preserves unlimited legacy behavior. Set an explicit production limit based on client needs.

Search parameter registry​

YAML keyEnvironment variableDefaultEffect
searchParams.watchSEARCH_PARAM_WATCHfalseKeep each replica's in-memory SearchParameter registry in sync with changes made by other replicas.

The search-parameter registry is held in each server process. When one replica creates a SearchParameter (or loads an Implementation Guide), searchParams.watch makes the others reload their copy over PostgreSQL LISTEN/NOTIFY instead of staying stale until a restart — see Custom search parameters. It is off by default, so a single-node deployment is unaffected; enable it when running more than one replica.

Implementation Guides​

YAML keyEnvironment variableDefault
ig.packagesIG_PACKAGESEmpty
ig.registryUrlIG_REGISTRY_URLhttps://packages.fhir.org
ig.forceReloadIG_FORCE_RELOADfalse
ig.cacheDirIG_CACHE_DIR.fhir-ig-cache

Validation and terminology​

Validation toggles live in the validation: YAML block and can be overridden per setting by environment variable. An unparseable boolean value fails startup.

YAML keyEnvironment variableDefaultEffect
validation.baseFHIR_VALIDATION_BASEtrueBase R4 structural validation on writes; set false to disable.
validation.profileFHIR_VALIDATION_PROFILEfalseSet true to enforce declared profiles on create and update.
validation.referentialIntegrityOnWriteFHIR_VALIDATION_REFERENTIAL_INTEGRITY_ON_WRITEtrueRejects writes whose local literal references do not resolve (422) — see Validation.
validation.referentialIntegrityOnDeleteFHIR_VALIDATION_REFERENTIAL_INTEGRITY_ON_DELETEtrueRejects deletes of resources still referenced by others (409) — see Validation.

Terminology is environment-variable only; it has no YAML key:

Environment variableDefaultEffect
FHIR_TERMINOLOGY_URLEmpty (disabled)Base URL of the external FHIR terminology server used by terminology-backed search modifiers.
tip

Keep secrets in environment variables or a secret manager. Use YAML for non-secret, reviewable deployment defaults.

See Performance tuning before changing search-plan or write-path controls.