Skip to content

Environment overrides with CONFIG_FORCE_*

Typesafe Config supports overriding dotted HOCON paths via environment variables prefixed with CONFIG_FORCE_.

Underscore mapping

Underscore sequence Mapped character
_ .
__ -
___ _

4+ consecutive underscores are invalid and raise a bad-path error.

Enablement

CONFIG_FORCE_* overrides are active when JVM property config.override_with_env_vars=true is enabled.

In standard {{ product_name }} runtime launch configurations, this flag is enabled by default.

java -Dconfig.override_with_env_vars=true -jar bin/alpine-server.jar

Examples for dotted keys

# db.dataSource.serverName = "postgres-prod.internal"
export CONFIG_FORCE_db_dataSource_serverName=postgres-prod.internal

# db.maximumPoolSize = 30
export CONFIG_FORCE_db_maximumPoolSize=30

# monitor.registries.prometheus.http.port = 9090
export CONFIG_FORCE_monitor_registries_prometheus_http_port=9090

Example for keys containing -

alpine.services.alpine-keyserver.hsm.threadsPerKey becomes:

export CONFIG_FORCE_alpine_services_alpine__keyserver_hsm_threadsPerKey=6

About -DCONFIG_FORCE_...

CONFIG_FORCE_* is an environment-variable mechanism.

If you want direct JVM property overrides, use dotted keys:

java \
  -Ddb.dataSource.serverName=postgres-prod.internal \
  -Ddb.maximumPoolSize=30 \
  -jar bin/alpine-server.jar