Include env variable in HOCON

scala

Found a way to override default config by environment variable in typesafe config. I’ve never used it before. Note it here.

a = 1
a = ${?A} 

// used in Kamon
excludes = ${?EXCLUDES} [ ]
  • a is default to 1. If environment variable A is set, it will replace the value of a, otherwise it will vanish and remain 1.
  • excludes is an empty list by default. It will be overrode by EXCLUDES if it’s defined.