Attempting to use ${HOSTNAME}
in a config file does not work! According to the documentation, config files should resolve environment variables as mentioned in the docs:
substitutions fall back to environment variables if they don't resolve in the config itself, so ${HOME} would work as you expect. Also, most configs have system properties merged in so you could use ${user.home}.
Is there a way to get hostname into the config file?
Reproduction
Add host.name=${HOSTNAME}
to an application.conf
file, then try and access it from anywhere. For example try adding
Logger.info(s"Hostname is ${current.configuration.getString("host.name").getOrElse("NOT-FOUND")}")
to the Global.scala
.
Environment
This was run on a RHEL6 environment where echo $HOSTNAME
produces precise32
so the environment variable exists, this is not the program hostname
.
application.conf
and also where you use that in the application as well. – mabahost.name
configuration variable. – tysonjh