I have a core library that sets its configuration as system properties.
mail.from = [email protected]
I wanted to override my config with them, like:
my.mail.from = "[email protected]"
my.mail.from = ${?mail.from}
This works in unit tests. In my Play (2.6) application it does not.
PropertiesConfiguration.init() // this inits the system properties
info("mail.from: " + sys.props.get("mail.from")) // >> '[email protected]' as expected
val config = ConfigFactory.load()
info("my.mail.from: " + config.getString("my.mail.from")) // >> '[email protected]' instead of '[email protected]'
Is this not possible or do I miss something?
Try invalidating any cached configurations in order to pick up changes to system properties:
PropertiesConfiguration.init()
info("mail.from: " + sys.props.get("mail.from"))
ConfigFactory.invalidateCaches()
val config = ConfigFactory.load()
info("my.mail.from: " + config.getString("my.mail.from"))