In default uses of the library, exact-match system properties already override the corresponding config properties. However, you can add your own overrides, or allow environment variables to override, using the ${?foo}
substitution syntax.
basedir = "/whatever/whatever"
basedir = ${?FORCED_BASEDIR}
Here, the override field basedir = ${?FORCED_BASEDIR}
simply vanishes if there's no value for FORCED_BASEDIR
, but if you set an environment variable FORCED_BASEDIR
for example, it would be used.
A natural extension of this idea is to support several different environment variable names or system property names, if you aren't sure which one will exist in the target environment.
Object fields and array elements with a ${?foo}
substitution value just disappear if the substitution is not found:
// this array could have one or two elements
path = [ "a", ${?OPTIONAL_A} ]
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
zeebox {env = "localhost"env = ${?ZEEBOX_ENV}hostname = "localhost"hostname = ${?HOSTNAME}nodename = ${zeebox.component}"-"${zeebox.hostname}}
Okay... So it turns out that HOSTNAME is an internal variable provided by bash, and that it's not in the environment as such! Nor is it is available through java.util.Properties.The only solutions that seem available now are:
- Manually create an environment variable containing the required name
- Push the results of `InetAddress.getLocalHost.getHostName` into a system property before the Akka config is loaded.
The second approach intrigues me, as it could be quite powerful. Has anybody managed to do anything like this before?
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
I'm working with Spray in a servlet container. So creating a listener for this solved the problem nicely...I must now figure out what else I can do with my new-found powers :)
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.