Trying to use ${HOSTNAME} in the configuration file does not work! According to the documentation, configuration files should allow environment variables, as indicated in the documents:
Lookupsreturn to environment variables if they are not resolved in the configuration itself, so $ {HOME} will work as you expect. In addition, most configurations combine system properties, so you can use $ {user.home}.
Is there a way to get the hostname in the configuration file?
Play
Add host.name=${HOSTNAME} to the application.conf file, then try to access it from anywhere. For example, try adding
Logger.info(s"Hostname is ${current.configuration.getString("host.name").getOrElse("NOT-FOUND")}")
at Global.scala .
Environment
This was done in the RHEL6 environment, where echo $HOSTNAME creates precise32 , so there is an environment variable, it is not a hostname program.
akka playframework configuration typesafe
tysonjh
source share