Skip to content
Reference

Environment variables

Every engine setting in .env, with its default and when you need it.

On this page

The engine reads its configuration from environment variables. With Docker Compose they live in apps/engine/.env; start from apps/engine/.env.example. Everything not marked required has a working default for a local stack.

Required

VariableWhat it is
DATABASE_URLPostgreSQL connection string. The default points at the bundled postgres service. The engine runs its sessions in UTC (it adds options=-c TimeZone=UTC unless you set a time zone yourself). Behind PgBouncer (pgbouncer=true), set the database's own zone instead: ALTER DATABASE <name> SET timezone = 'UTC'.
REDIS_URLRedis connection string. The default points at the bundled redis service.
ENCRYPTION_MASTER_KEYKey for AES-256-GCM encryption of adapter credentials and other secrets at rest. 64 hex characters: openssl rand -hex 32.
ENGINE_AUTH_SECRETSigns tokens and sessions. At least 64 characters: openssl rand -hex 64.
LICENSE_KEYThe signed license issued by 1Putt under your contract (mdh_lic_v1.…).
METRICS_TOKENToken Prometheus sends to /api/metrics. At least 32 characters.
MLLP_ENGINE_TOKENToken the MLLP listener sends to the engine. At least 32 characters. Needed when you receive HL7v2 over MLLP.
ALLOWED_ORIGINSComma-separated origins allowed to call the engine API from another web app in a browser (CORS). When unset, the engine's own ENGINE_PUBLIC_URL; with neither, localhost only. * never matches.

Security and sign-in

VariableDefaultWhat it does
ENGINE_PUBLIC_URLunsetThe engine's public address behind a proxy. Used for sign-in links, the CSRF check and the Google redirect URI.
ENGINE_REFRESH_TOKEN_TTL30dHow long an API client's refresh token lasts (12h, 90d, at most 365d). See Authentication.
ENGINE_ROOT_TOKEN_ENABLEDoff in productionAllows root-secret tokens. See Authentication.
ENGINE_GOOGLE_CLIENT_ID, ENGINE_GOOGLE_CLIENT_SECRETemptyGoogle Workspace sign-in. Off unless both are set, plus ENGINE_ALLOWED_DOMAINS.
ENGINE_ALLOWED_DOMAINSemptyWorkspace domains that may sign in, comma-separated.
ENGINE_BREAK_GLASS_EMAILemptyWith "Require SSO for everyone" on, the one admin who may still sign in with a password. Empty: any admin may.
ENGINE_TRUSTED_DEVICE_DAYS0 (off)Days a browser may skip the emailed sign-in code after "Remember this device", 1 to 90 (Helm sso.trustedDeviceDays). The password is still asked. 0 turns it off and stops every remembered device.
ENGINE_SESSION_IDLE_MINUTES60Minutes without activity after which a person's session ends, 1 to 720 (Helm sso.sessionIdleMinutes). Background refreshes don't count as activity. Out of range: ignored with a warning.
ENGINE_SESSION_MAX_HOURS12Hours after sign-in at which every session ends, however active, 1 to 24 (Helm sso.sessionMaxHours). Out of range: ignored with a warning.
ENGINE_DEFAULT_ROLEoperatorRole for people created by their first Google sign-in.
ENGINE_EMAIL_FROMunsetSender for sign-in codes and links. Needs RESEND_API_KEY or ENGINE_EMAIL_WEBHOOK_URL.
RESEND_API_KEYunsetSends engine email through Resend.
ENGINE_EMAIL_WEBHOOK_URL, ENGINE_EMAIL_WEBHOOK_TOKENunsetSends engine email through a webhook of your own. The engine posts each message and sends the token as a bearer token.
CLIENT_IP_SOURCEnoneWhich header your proxy writes the client IP to: none, gclb, last-hop or x-real-ip. See Client IP addresses.
TRUSTED_PROXY_HOPS0Proxies in front of the one CLIENT_IP_SOURCE names (e.g. 1 for Cloudflare in front of GCLB). Alone, it keeps its old meaning.
AI_ZERO_DATA_RETENTIONunsettrue when a zero-data-retention agreement covers your AI provider: the BAA card then reads "zero · not used for training". Otherwise it names the provider's standard terms.
AUDIT_FLAG_TIMEZONEunsetPins the zone the audit flags' working hours (06:00 to 22:00) are judged in. Unset: each workspace's zone, else the engine's (TZ).
IP_ALLOWLIST_FAIL_OPENtrueWhether requests pass when the IP allowlist cannot be read. Set false to block instead.
ALLOW_PRIVATE_URLSfalseLets adapters reach private IP ranges. The engine ignores it when NODE_ENV=production and logs a warning. Use SSRF_ALLOWLIST instead.
ENCRYPTION_MASTER_KEY_PREVIOUSunsetOld keys, kept for decryption only while you rotate the master key.
MESSAGE_ENCRYPTION_KEYthe master keyKey for stored message encryption. At least 32 characters.
MESSAGE_ENCRYPTION_KEY_PREVIOUSunsetOld message keys, comma-separated, kept so older stored messages still read.
ENCRYPT_STORED_MESSAGESfalsetrue encrypts every workflow's stored messages, whatever each workflow's own setting says.

Single sign-on

One generic OIDC identity provider and one SAML 2.0 identity provider. Both need ENGINE_PUBLIC_URL: the redirect URI, entity ID and ACS URL are built from it, never from the request's Host. Each is off until its first three variables are set, and turns itself off (with an error in the log) when a value doesn't parse. More providers can be added in Settings → Single sign-on → Other identity providers. See Single sign-on.

VariableDefaultWhat it does
ENGINE_OIDC_ISSUERunsetThe IdP's issuer URL (https; http only for a loopback test IdP). Discovery is read from it.
ENGINE_OIDC_CLIENT_ID, ENGINE_OIDC_CLIENT_SECRETunsetThe confidential client registered at the IdP. Keep the secret in your secrets manager.
ENGINE_OIDC_LABELSingle sign-onButton text: Continue with the label.
ENGINE_OIDC_SCOPESopenid email profileScopes to ask for, space-separated.
ENGINE_OIDC_GROUPS_CLAIMgroupsid_token claim with the person's groups or roles (roles for Entra app roles).
ENGINE_OIDC_TOKEN_AUTHclient_secret_basicclient_secret_post sends the secret in the body instead.
ENGINE_OIDC_TRUST_EMAILfalseLet an email without email_verified create a new person (Entra single-tenant apps). Never links an existing account.
ENGINE_SAML_IDP_ENTITY_IDunsetThe IdP's entity ID (the Issuer of its assertions).
ENGINE_SAML_IDP_SSO_URLunsetThe IdP's single sign-on URL (HTTP-Redirect), https.
ENGINE_SAML_IDP_CERTunsetThe IdP's signing certificate, PEM or base64. Several during a rollover. \n escapes work.
ENGINE_SAML_LABELSAML single sign-onButton text.
ENGINE_SAML_SP_ENTITY_ID, ENGINE_SAML_ACS_URLfrom ENGINE_PUBLIC_URLThe engine's entity ID and ACS URL, if the IdP needs others. Setting both runs SAML without ENGINE_PUBLIC_URL.
ENGINE_SAML_GROUPS_ATTRIBUTEcommon namesAttribute with groups; by default groups, memberOf and the Microsoft group and role claims.
ENGINE_SAML_TRUST_EMAILtrueLet an email the IdP does not mark verified create a new person. Never links an existing account.
ENGINE_SAML_REQUIRE_SIGNED_RESPONSEfalseAlso require the Response signature. The assertion signature is always required.
ENGINE_OIDC_GROUP_ROLES, ENGINE_SAML_GROUP_ROLESemptygroup=role entries, ; or new line separated. Roles: viewer, operator, admin.
ENGINE_OIDC_DEFAULT_ROLE, ENGINE_SAML_DEFAULT_ROLEunset (refuse)Role for people whose groups match no entry. Unset refuses them.
ENGINE_OIDC_ALLOWED_DOMAINS, ENGINE_SAML_ALLOWED_DOMAINSempty (any)Email domains that may sign in, comma-separated.
ENGINE_OIDC_REQUIRE_MFA, ENGINE_SAML_REQUIRE_MFAfalseRefuse sign-ins the IdP doesn't report as multi-factor.
ENGINE_OIDC_TRUST_IDP_MFA, ENGINE_SAML_TRUST_IDP_MFAfalseLet an IdP-reported MFA replace an authenticator the person enrolled in MedHook.

License

VariableDefaultWhat it does
LICENSE_REVOCATION_URLunset (Helm: https://medhook.dev/api/license/status)Where the engine asks whether 1Putt revoked its license, at startup and every 6 hours. Unset turns the check off.
SKIP_LICENSE_VALIDATIONunsettrue skips the license check when running the engine from source (next dev). Release images always run as production and refuse to start with it.

Runtime and retention

VariableDefaultWhat it does
NODE_ENVproduction in .env.exampleproduction, development or test.
LOG_LEVELinfodebug, info, warn or error.
MAX_CONCURRENT_WORKFLOWS20 (.env.example sets 5)Executions one engine replica runs at the same time. One queue per process, so this is the replica's real capacity.
AUDIT_LOG_RETENTION_DAYS2190 (six years)Expired audit events are archived to AUDIT_LOG_ARCHIVE_DIR, then deleted. With no archive, nothing is deleted.
AUDIT_LOG_ARCHIVE_DIRunsetWhere expired audit events are written before deletion.
EXECUTION_RETENTION_DAYS2190Executions and step results older than this are deleted every 6 hours. 0 keeps them. A workflow can set its own retention with PUT /api/workflows/{id}/retention.
EXECUTION_ARCHIVE_DIRunsetWhere expired executions are archived (gzip NDJSON, message content encrypted) before retention deletes them. Unset: no archive.
GRAPHQL_ENABLEDofftrue turns on /api/graphql.
AUDIT_LOG_PURGE_UNARCHIVEDunsettrue deletes expired audit events even with no archive. Leave it off if you must keep six years.
ALERT_RULES_ENABLEDonfalse stops the alert rule runner.
SAMPLE_FETCH_ENABLEDonfalse turns off Fetch a sample in the workflow builder: a live, read-only read of a polling trigger's (or a first read step's) connection whose first item becomes the sample.
WORKFLOW_TIMEOUT_MS1800000 (30 minutes)The longest one execution may run before the engine aborts it.
MAX_CONCURRENT_ADAPTER_CALLS10Calls in flight at once for each adapter profile, per engine process. A profile's maxConcurrentCalls replaces it with a cap across all replicas.
ADAPTER_SLOT_WAIT_MS60000How long a step waits for a profile's call slot or calls-per-second token. Then it fails without sending, and its retry applies.
EXECUTION_NODE_RESULT_MAX_BYTES10485760 (10 MiB)The largest step output stored in an execution's history. A larger one is stored as a truncated marker.
WORKFLOW_MAX_PENDING5000Pending executions a workflow may have. Past that, inbound deliveries are answered 503 NOT_ACCEPTED, or AE over MLLP.
INTAKE_SLOW_ACK_FROMa fifth of WORKFLOW_MAX_PENDING (1000)Graceful back-pressure: from this many pending executions of a workflow, the answer to an accepted delivery (the AA, or the 2xx) waits a little before it is sent. The delivery is already recorded. A sender that sends one message at a time then keeps pace with the engine.
INTAKE_SLOW_ACK_MAX_MS1500The wait at WORKFLOW_MAX_PENDING. It rises evenly from 0 at INTAKE_SLOW_ACK_FROM. 0 turns the wait off. At most 10000.
INTAKE_BACKLOG_CACHE_MS1000How long intake reuses a workflow's pending count, plus what it accepted since, while the backlog is well under WORKFLOW_MAX_PENDING. Near the cap each delivery counts again, so the cap is exact. 0 counts on every delivery.
MESSAGE_SEARCH_TIMEOUT_MS20000Statement timeout on the indexed part of a Messages search (1000 to 300000). A search that runs longer answers 503 SEARCH_TIMEOUT and frees its database connection instead of holding it.
WORK_POLL_MS1000How often the work runner looks for pending executions.
SFTP_SESSION_IDLE_MS60000How long an idle SFTP session to a profile stays open for reuse.
CRON_CATCHUP_MAX_SLOTS10The most missed cron slots one trigger with missedRuns catches up when an engine starts.
CRON_CATCHUP_WINDOW_HOURS24How far back missed cron slots are caught up.
SANDBOX_ALLOW_UNSAFE_VMofftrue runs custom JavaScript on node:vm when isolated-vm cannot load. It enforces no memory limit and is not a security boundary. Local development only; never in production.
SANDBOX_ROUTE_BUDGET100Runs a chain may queue with router.routeMessage in Mirth scripts: a run and every run it started share it, across replicas. 1 to 100000.
SHUTDOWN_TIMEOUT_MS30000How long the engine waits for running executions to finish when it stops.
REDIS_EXECUTION_TTL_SECONDS900How long the live status snapshot of an execution stays in Redis. From 60 to 3600.
EXECUTION_HEARTBEAT_INTERVAL_MS30000How often a running execution records that its engine instance is alive.
EXECUTION_STALE_AFTER_MS120000A running execution with no heartbeat for this long is failed by recovery, or put back to pending if it had not started a step. At least three heartbeat intervals.
EXECUTION_RECOVERY_SWEEP_MS60000How often each engine instance looks for orphaned executions.
ENGINE_IDderivedThe name this engine gives itself when it publishes a workflow to the marketplace.
REDIS_PASSWORDunsetThe Redis password, used when REDIS_URL carries none, as with a managed Redis.
REDIS_TLS_CA_FILEunsetA PEM file with the Redis server's CA, for a rediss:// URL. Set with a redis:// URL, the engine refuses to connect.
BULK_REPROCESS_MAX1000The most messages one bulk reprocess request may run again. At most 10000.
MIGRATION_CUTOVER_MIN_MESSAGES100A parallel run's Cut over recommends (in a production workspace, past it only with Cut over anyway and a reason) that the run has compared this many messages. A value that is not a whole number keeps the default.
MIGRATION_CUTOVER_MIN_DAYS7A parallel run's Cut over recommends that the run is this many days old. 0 turns the wait off.
MIGRATION_CUTOVER_MIN_PER_TYPE1A parallel run's Cut over recommends that each message type the run has seen has this many compared messages.
WEB_APP_URLhttps://medhook.devThe medhook.dev address the engine uses to publish to and import from the workflow marketplace, for the opt-in support heartbeat and for the diagnostics reachability check. The license check does not use it. Helm sets it from engine.env.WEB_APP_URL.
MEDHOOK_SKIP_MIGRATIONSfalsetrue makes the image start the server without applying database migrations first. Helm sets it, because its migrate init container already applied them.
NODE_EXTRA_CA_CERTSunsetNode's own setting: a PEM file of extra CAs the engine trusts. A SQL Database profile for Oracle over TLS needs its private CA here, not in the profile. Set it with engine.env and a mounted file; Helm does not set it on the engine.

Workflow limits

Caps that keep one workflow from starving a shared engine. Each can be raised (or lowered) up to a hard ceiling; a value above it is clamped to it, and a value that is not a whole number is ignored. With Helm, set workflowLimits.*.

VariableHelm valueDefaultRangeWhat it caps
SANDBOX_MEMORY_LIMIT_MBworkflowLimits.sandboxMemoryMb12832 to 1024Memory of one JavaScript step, shared library or JavaScript Writer run.
SANDBOX_CODE_TIMEOUT_MSworkflowLimits.sandboxTimeoutMs5000100 to 120000Time of one script run, its engine calls (http.request, database, files, routes) included. Also a script database statement's timeout.
SANDBOX_DB_MAX_ROWSworkflowLimits.sandboxDbMaxRows10001 to 10000Rows one script executeCachedQuery may return; more fails the call.
SANDBOX_HTTP_MAX_CALLSworkflowLimits.sandboxHttpMaxCalls201 to 200http.request calls per script run.
SANDBOX_HTTP_MAX_BYTESworkflowLimits.sandboxHttpMaxBytes8388608 (8 MiB)1 KiB to 32 MiBRequest and response bodies of a run's http.request calls.
MAX_LOOP_ITERATIONSworkflowLimits.maxLoopIterations10001 to 100000Items one loop step runs (a loop's maxIterations up to it), and the default of WEBHOOK_MAX_NDJSON_RESOURCES.
WORKFLOW_MAX_CALL_DEPTHworkflowLimits.workflowMaxCallDepth51 to 25Workflows deep a chain of Run workflow, Call workflow, topic and routeMessage runs may go.
SOAP_MAX_BODY_BYTESworkflowLimits.soapMaxBodyBytes5242880 (5 MiB)1 byte to 50 MiBLargest SOAP listener request body; larger is 413. The envelope is parsed with the same limit.

The builder's checks show the defaults; save and deploy check again with the engine's values. Raising a memory or time limit lets one step hold a worker longer: raise MAX_CONCURRENT_WORKFLOWS or the engine's resources with it.

PHI

VariableDefaultWhat it does
MEDHOOK_PHI_ENFORCEMENTenabledBlocks workflows marked as handling PHI unless the signed license allows PHI, which 1Putt sets once the BAA is executed. warn only logs; disabled is for development.
MEDHOOK_PHI_ALLofftrue treats every workflow as handling PHI.

Inbound triggers

VariableDefaultWhat it does
WEBHOOK_ALLOW_UNSIGNEDfalseLets webhook triggers without an HMAC secret accept unsigned requests. Leave it off.
TRIGGER_RATE_LIMIT_PER_MINUTE600Requests per minute for each webhook or FHIR subscription.
MLLP_INGEST_RATE_LIMIT6000Requests per minute from the MLLP listener.
DICOM_ENGINE_TOKENnoneToken the DICOM listener sends to /api/triggers/dicom. At least 32 characters; use the same value on the listener. Needed when you receive DICOM.
DICOM_INGEST_RATE_LIMIT6000Requests per minute from the DICOM listener.
DICOM_MAX_OBJECT_BYTES134217728 (128 MiB)Largest DICOM object the engine stores, and the most a Deflated object may inflate to when a DICOM step sends it. Use the listener's value.
DICOM_STORE_DIR/var/lib/medhook/dicomWhere received DICOM objects are kept (Helm dicom.store). Every engine replica needs it: ReadWriteMany with more than one.
DICOM_STORE_RETENTION_DAYS30Days a stored DICOM object and its reference last. 0 keeps objects; references then expire after 365 days.
MLLP_REPLAY_TARGETSunsethost:port pairs that batch replay may send to over MLLP. Unset turns MLLP replay off.
WEBHOOK_MAX_BODY_BYTES10485760Largest webhook body, in bytes. A larger one is refused with 413.
WEBHOOK_MAX_NDJSON_RESOURCESMAX_LOOP_ITERATIONSMost resources in one NDJSON webhook upload (default: the loop limit, 1000).
INBOUND_DEDUP_TTL_HOURS24How long the engine remembers what it accepted, to drop resends: an MSH-10, an Idempotency-Key, a FHIR resource version, X12 control numbers, and SFTP pickup files once they leave the folder.
INBOUND_RETRY_AFTER_SECONDS30The Retry-After on every 503 from a webhook, X12 or FHIR subscription intake: nothing was recorded, or the original is still being recorded.
WEBHOOK_SYNC_MAX_WAITERS50Webhook and SOAP answers in response.mode: destination one replica waits for at once. Past that, the sender gets 202 at once.
SOAP_MAX_BODY_BYTES5242880Largest SOAP request body, in bytes, at most 50 MiB (workflow limits). A larger one is refused with 413 before parsing.
JMS_MAX_MESSAGE_BYTES10485760Largest JMS message the JMS Listener reads, in bytes. A larger one is rejected (dead-lettered by the broker) without being read.
WORK_LANE_LEASE_MS120000How long one engine replica holds an ordering lane (MLLP sending facility, or a fifo trigger) while its message runs. Renewed every quarter.
WORK_LANE_CONTINUE_MAX32Messages one replica runs in a row from an ordering lane, on one lease, before the lane yields to other lanes. 0 hands the lane back after every message.
WORK_GRAPH_CACHE_MS1000How long the work runner serves a workflow's graph without checking it, when the graph is asked for without a claim. A claimed message is always checked against the stamp its claim returned. 0: every time.
FHIR_SUBSCRIPTION_SYNC_ON_STARTUPonfalse stops the engine from refreshing FHIR subscriptions when it starts.
MEDPLUM_REQUEST_TIMEOUT_MS10000Timeout of each Medplum request the engine makes to manage FHIR subscriptions.
FHIR_SUBSCRIPTION_SAVE_SYNC_BUDGET_MS15000Longest a workflow save waits for its FHIR subscription sync; after that the sync continues in the background.
ENGINE_BASE_URLhttp://engine:3000The engine address the local Medplum server calls back for FHIR subscriptions. Set it when the engine is not reachable from Medplum at that name.
MLLP_ADVERTISED_HOST, MLLP_ADVERTISED_PORTunset, then MLLP_PORTThe address and port the builder shows senders as Listening on. Helm sets the host from mllp.advertisedHost.
MLLP_INTERNAL_HOSTunsetThe MLLP listener's in-cluster address, which the builder also shows. Helm sets it to the listener Service's DNS name whenever mllp.enabled is on.
MLLP_TUNNEL_NAMEunsetThe site-to-site tunnel MLLP senders come through. The builder and the workflow list show its state next to MLLP workflows. Set it with engine.env.
MLLP_HEALTH_URLhttp://medhook-mllp:8080/healthThe MLLP listener's health route, read by /api/health and diagnostics. Helm sets it from the release's internal MLLP Service and mllp.healthPort.
SMART_CLIENT_ID, SMART_CLIENT_SECRETemptyThe client the SMART on FHIR launch uses.
SMART_REDIRECT_URIthe engine's /api/auth/smart/callbackWhere the EHR sends the browser after authorization.

MLLP listener

The MLLP listener is a separate container. These variables are set on it, not on the engine. See MLLP and ACKs.

VariableDefaultWhat it does
MLLP_PORT2575The TCP port the listener binds to.
MLLP_LISTENERSnoneJSON list of named listeners (name, port, ackMode, tls, and for raw TCP framing, startBytes, endBytes, response, maxConnections, idleTimeoutMs, frameTimeoutMs). Helm renders it from mllp.listeners into the configmap both read. Under Docker Compose, set it in .env; the Compose file passes it to the engine and to mllp-server, which must see the same value: an engine that does not see a raw TCP listener refuses its data, the listener answers AE, and the sender retries forever. A bad value stops the listener.
MLLP_HOST0.0.0.0The interface it binds to.
MLLP_TIMEOUT30000Milliseconds it waits for the engine before it sends AE.
MLLP_MAX_FRAME_BYTES10485760 (10 MiB)The largest message in one frame. A larger frame gets AR and the connection closes.
ENGINE_URLthe engine serviceWhere it posts messages.
MLLP_ENGINE_TOKENnoneThe token the engine requires. Use the same value on both. At least 32 characters.
HEALTH_PORT8080The health endpoint's port.

DICOM listener

The DICOM listener is a separate container (Helm dicom.*). These variables are set on it, not on the engine. See Triggers: DICOM.

VariableDefaultWhat it does
DICOM_PORT11112The TCP port the listener binds to.
DICOM_AE_TITLEMEDHOOKThe listener's AE title. An association that calls another one is refused.
DICOM_ALLOWED_CALLING_AE_TITLESempty (any caller)Comma-separated calling AE titles to accept. A routing check, not authentication: restrict the network, or use mutual TLS.
DICOM_MAX_OBJECT_BYTES134217728 (128 MiB)The largest object. A larger one aborts the association. Also caps any other DIMSE dataset.
DICOM_MAX_ASSOCIATIONS10Associations at once, one C-STORE at a time each. Past that, a new one is refused with a transient reason.
DICOM_MAX_INFLIGHT_BYTES536870912 (512 MiB)Object bytes held at once across all associations, at least DICOM_MAX_OBJECT_BYTES. Past it a C-STORE is answered Out of Resources (0xA700). Size memory at 2 x this + 64 MiB per association + 128 MiB. Slow senders with large objects can hold it until their association lifetime ends: restrict the port, or shorten DICOM_MAX_ASSOCIATION_LIFETIME_MS.
DICOM_IDLE_TIMEOUT_MS60000Time an associated peer may stay silent between PDUs; paused while the engine records an object. Past it the connection is dropped.
DICOM_ASSOCIATION_TIMEOUT_MS10000Time a peer has from connecting to finish its association request. Trickled bytes don't extend it.
DICOM_MAX_PENDING_CONNECTIONS32Connections not yet associated, across all peers. Past it a new connection is closed at once.
DICOM_MAX_CONNECTIONS_PER_IP8Open connections from one address: an IPv4 address, or an IPv6 /64 (::a.b.c.d and NAT64 64:ff9b::a.b.c.d senders share one). Raise it when a load balancer hides client addresses. Many IPv4 sources can still fill the pending pool: restrict the port with dicom.networkPolicy.allowedCidrs.
DICOM_MAX_ASSOCIATION_LIFETIME_MS3600000 (1 h)Longest an association lasts, however active; then A-ABORT and the sender reconnects. 0 turns it off (Mirth has no such limit).
DICOM_ENGINE_TIMEOUT_MS60000Milliseconds it waits for the engine before it answers Out of Resources (0xA700).
DICOM_TLS_CERT_FILE, DICOM_TLS_KEY_FILEnonePEM certificate and key: set both to listen over TLS (1.2 or later, DICOM_TLS_MIN_VERSION).
DICOM_TLS_CA_FILE, DICOM_TLS_REQUIRE_CLIENT_CERTnone, falsetrue requires a client certificate signed by that CA (mutual TLS). It is not tied to an AE title.
ENGINE_URLthe engine serviceWhere it posts objects.
DICOM_ENGINE_TOKENnoneThe token the engine requires. Use the same value on both. At least 32 characters.
HEALTH_PORT8080The health and metrics port.

Network safety

Adapters that call out to a URL refuse addresses in private, loopback and link-local ranges.

VariableDefaultWhat it does
SSRF_ALLOWLISTemptyComma-separated host names or addresses that skip the check, such as one internal FHIR server, and CIDRs whose private addresses may be reached, such as 10.20.0.0/16. Never opens link-local or metadata addresses; a CIDR never opens loopback or the engine's own ranges.
SSRF_DENYLISTemptyComma-separated host names or addresses that are always blocked, on top of the built-in ranges.

The FTP, SMB and WebDAV adapters follow these rules too: a private file server needs its name or address in SSRF_ALLOWLIST, and the engine connects to the address it checked.

VariableDefaultWhat it does
FILE_ADAPTER_ROOTSemptyComma-separated absolute folders a Local File profile may use; its baseDir must be one of them or inside one, after symlinks are resolved. Empty refuses every path. Helm sets it from fileAdapter.mounts.

The EHR setup sandbox patient test calls only the Epic and Oracle Health public sandboxes. For a test or self-hosted sandbox that never holds live PHI:

VariableDefaultWhat it does
EHR_SANDBOX_HOSTSemptyComma-separated extra hosts the sandbox patient test may call. Plain http is allowed for these hosts only.
EHR_SANDBOX_HOSTS_IN_PRODUCTIONfalsetrue honours EHR_SANDBOX_HOSTS on an engine with NODE_ENV=production. Otherwise production ignores it.

Log export

Set these to send engine logs to an external service. Pick one provider. Saved settings override these: once an admin saves in Settings → Notifications → Log export (or calls POST /api/settings/log-export), the engine ignores these variables until someone chooses Clear saved settings. Credentials are never returned. See Log exporters.

VariableDefaultWhat it does
LOG_EXPORT_PROVIDERnonenone, datadog, cloudwatch or splunk.
DATADOG_API_KEYunsetThe Datadog key.
DATADOG_SITEdatadoghq.comThe Datadog site.
DATADOG_SERVICEunsetThe service name on each log line.
AWS_REGIONus-east-1The CloudWatch region.
CLOUDWATCH_LOG_GROUP/medhook/engineThe log group.
CLOUDWATCH_LOG_STREAMexecution-logsThe log stream.
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEYunsetThe AWS credentials for CloudWatch.
SPLUNK_HEC_URLunsetThe HTTP Event Collector URL.
SPLUNK_HEC_TOKENunsetThe collector token.
SPLUNK_INDEXmainThe index.
SPLUNK_SOURCEmedhookThe source name.

Google Cloud

On GKE, Terraform passes these to the Helm chart in engine.env, and the chart sets them on the engine. You rarely set them by hand. Site-to-site tunnels stay off until the Classic VPN group is complete. See Site-to-site tunnels.

VariableDefaultWhat it does
GCP_PROJECT_ID, GCP_REGIONunsetThe project and region the engine runs in. Used for tunnels, support access, diagnostics and the Settings page. Unset means the engine is not on GCP.
GCP_VPC_NETWORKunsetThe VPC network tunnels route into.
GCP_VPN_GATEWAY, GCP_VPN_GATEWAY_IPunsetMedHook's Classic VPN gateway and its public address.
VPN_LOCAL_SUBNETSunsetComma-separated subnets on MedHook's side of each tunnel. Terraform sets the node subnet.
VPN_EXTRA_LOCAL_RANGESunsetComma-separated extra local ranges every tunnel carries next to the node subnet: your other VPCs or on-prem networks (Use MedHook tunnels for your other applications). Terraform sets it from vpn_extra_local_ranges. VPN_LOCAL_SUBNETS keeps meaning the node subnet.
GCP_VPN_NAME_PREFIXmedhookPrefix of the GCP names of new tunnels. Terraform sets the environment's name (e.g. medhook-staging), so each environment's tunnel-down alert matches only its own tunnels. Existing tunnels keep their names.
GCP_VPN_GATEWAY_SECONDARY, GCP_VPN_GATEWAY_SECONDARY_IPunsetThe second Classic gateway, for a backup tunnel. Terraform sets both with vpn_secondary_gateway_enabled.
GCP_HA_VPN_GATEWAY, GCP_HA_VPN_GATEWAY_IPSunsetThe HA VPN gateway and its two interface addresses, comma-separated.
GCP_CLOUD_ROUTER, GCP_CLOUD_ROUTER_ASNunsetThe Cloud Router and ASN for HA VPN's BGP sessions. HA VPN stays off without all four HA values.
GCP_HEALTHCARE_FHIR_STOREunsetA Cloud Healthcare FHIR store, as projects/…/locations/…/datasets/…/fhirStores/…. The Adapters page's FHIR store card and the Google Cloud Healthcare FHIR adapter use it. Helm sets it from fhirStore.gcpHealthcare.name. Unset: the card shows the bundled Medplum.
MEDHOOK_SECRET_PREFIXmedhookThe Secret Manager prefix the Settings page uses to name the engine's secrets. Match Terraform's secret_prefix. Display only.
SUPPORT_GROUPthe 1Putt support groupThe Google group Settings → Support access names. Match Terraform's support_group if you changed it.

Tunnel sample values

VariableDefaultWhat it does
TUNNEL_SAMPLE_VALUESunsetJSON sample for Use sample values on New tunnel, for demo engines. See Sample values for demos. Admins only; never holds a pre-shared key. Helm sets it from engine.tunnelSampleValues.

Tunnel watcher

The engine watches its Classic and HA VPN tunnels and fails over, re-establishes and fails back on its own. See Self-healing watcher. The defaults suit most deployments.

VariableDefaultWhat it does
TUNNEL_WATCHER_ENABLEDon with GKE tunnelsfalse turns the watcher off.
TUNNEL_WATCHER_POLL_MS15000How often it reads tunnel status. Never below 10 seconds in production.
TUNNEL_WATCHER_DOWN_READS4Bad reads in a row before a tunnel counts as down (60 s at the 15 s poll).
TUNNEL_WATCHER_REESTABLISH_AFTER_MS300000 (5 min)How long a tunnel stays down before it is re-created, and the time between attempts.
TUNNEL_WATCHER_FAILBACK_STABLE_MS300000 (5 min)How long a pair's primary must stay up before traffic moves back to it.
TUNNEL_WATCHER_MAX_ACTIONS_PER_HOUR4Actions per tunnel per hour before the watcher pauses on it.
TUNNEL_WATCHER_FLAP_DROPS3Drops (up to down) within the flap window that pause the watcher on a tunnel.
TUNNEL_WATCHER_FLAP_TRANSITIONSunsetOlder form of the above, in state changes; two count as one drop.
TUNNEL_WATCHER_FLAP_WINDOW_MS600000 (10 min)The flap window.
TUNNEL_WATCHER_LEASE_MS60000How long a replica holds a tunnel before another may take it over.

AI features

VariableDefaultWhat it does
ANTHROPIC_API_KEYemptyEnables AI mapping, condition and workflow suggestions. Empty hides them.
AI_FEATURES_ENABLEDoff in productionPrompts go to Anthropic, so with NODE_ENV=production AI stays off until you set true. Do that only once a BAA with Anthropic covers the deployment.
AI_PROVIDERanthropicWhich service runs AI calls: anthropic (the Anthropic API, ANTHROPIC_API_KEY) or vertex (Claude on your own Google Vertex project, with Workload Identity and no key). A bad value, or vertex without a project or region, stops the engine at startup while AI features are on. Helm engine.aiProvider, GKE Terraform engine_ai_provider. See AI under your own BAA (Vertex).
AI_VERTEX_PROJECTemptyWith AI_PROVIDER=vertex, the Google Cloud project whose Vertex AI runs Claude. Required. Helm engine.aiVertexProject, GKE Terraform engine_ai_vertex_project.
AI_VERTEX_REGIONemptyWith AI_PROVIDER=vertex, the Vertex region Claude runs in, for example us-east5. Required, so prompts are processed in one region you chose: the engine, the Helm chart and Terraform refuse global, us and eu. Helm engine.aiVertexRegion, GKE Terraform engine_ai_vertex_region.
CHAT_ENABLEDonThe Agent screen, which is the assistant: read-only answers over the engine API as the signed-in user, guided setup, and drafts you save yourself. On whenever AI features are on (AI_FEATURES_ENABLED and a configured AI provider: ANTHROPIC_API_KEY, or AI_PROVIDER=vertex with AI_VERTEX_PROJECT and AI_VERTEX_REGION); false (any case) switches it off, any other value leaves it on. Helm sets it from engine.chatEnabled, GKE Terraform from engine_chat_enabled (both default on). Switched off, the Agent screen says so and /api/ai/chat answers 404. See Assistant.
AI_MESSAGE_CONTENTonThe switch that turns message content in the assistant off. On, operators and admins may have message content sent to the model, masked first (patient-identifying values become tokens); this assumes a BAA covers the deployment or only sample data is used. false (any case) gives everyone metadata only: paths, field names, types and status, no values. Viewers always get metadata only. Helm engine.aiMessageContent. See Assistant.
AI_DAILY_TOKEN_LIMIT2000000Tokens the assistant (the Agent screen), its workflow drafts included, may use per UTC day, all users together. Cache writes count in full and cache reads (the system prompt and tool list, which are cached) at a tenth. A used-up budget answers 429 until midnight UTC. Helm engine.aiDailyTokenLimit, GKE Terraform engine_ai_daily_token_limit; unset keeps the default.
AI_DAILY_ITERATION_LIMIT500Requests the assistant may answer per UTC day: one per message, however many model calls it takes (a workflow draft is part of its message). Helm engine.aiDailyIterationLimit, GKE Terraform engine_ai_daily_iteration_limit; unset keeps the default.
AI_CHAT_VIEWER_DAILY_TOKEN_LIMIT20000Tokens one viewer may use in the assistant per UTC day, on top of the engine limit, so a read-only account cannot use up the engine's budget. Operators and admins use the engine limit only.

A limit must be a positive whole number, or unlimited (any case) to turn that cap off: usage is still counted and reported (GET /api/ai/chat answers that limit as null, with unlimited: true once neither tokens nor iterations are capped), and nothing answers 429 for it. Helm and GKE Terraform accept unlimited too. Any other value, 0 included, is ignored with a warning and the default applies.

Flat field paths (beta)

VariableDefaultWhat it does
FLAT_FIELD_PATHS_ENABLEDofftrue turns on the builder's Fields view of a sample (OBX[2].5, PID.3(2).1), the matching Data Map rows and filter picker options, Retrohook key rewriting, {{hl7:PATH}} in templates, the message inspector's Fields tab and flat AI prompts. Only true (any case) turns it on. Helm engine.flatFieldPathsEnabled, GKE Terraform engine_flat_field_paths_enabled. /api/version reports it as features.flatFieldPaths. Does not turn AI on. See Field paths.

Canary deploys (beta)

VariableDefaultWhat it does
CANARY_DEPLOY_ENABLEDonOn unless set to false: a workflow's Versions tab offers Rollout (Canary at 10, 25 or 50% of messages, or All at once) and When (Now, or Schedule at the workflow's quietest hour of the last 24 h), and the engine runs the job that promotes a canary after 30 minutes under 1% errors or rolls it back at 1% or more. false turns it off: nothing new starts, every message runs on the deployed version, and a running canary can still be promoted or rolled back.

Bundled services

VariableDefaultWhat it does
MEDPLUM_BASE_URLhttp://medplum-server:8103The local FHIR server, used by the medplum adapter.
MEDPLUM_CLIENT_ID, MEDPLUM_CLIENT_SECRETemptyMedplum client credentials.
GRAFANA_ADMIN_USER, GRAFANA_ADMIN_PASSWORDadminChange both before you expose Grafana.
GRAFANA_URLemptyWhere operators reach Grafana, http or https. The Dashboard's Engine services card links its Grafana row; empty hides it. Read on each request. Helm sets it from engine.env.GRAFANA_URL, and Terraform from grafana_url.
ENGINE_PORT, GRAFANA_PORT, MLLP_PORT, ...3000, 3002, 2575Host ports, if the defaults clash with other services.
VPN_TUNNELSunsetJSON list of tunnels for the optional IPsec container. Pre-shared keys are never returned by the API.

Reference