java - Play2 "include" directive override configuration with substitution -
i have following conf files in play2.1.0 application
- application.conf
- override.dev.conf
- override.qa.conf
- override.prod.conf
and there application.mode
property in application.conf file have either 1 of dev/qa/prod values.
application.conf has line include env/mode specific conf files override. not working substitution.
reason: have override properties in env/mode specific conf files.
referred: http://www.playframework.com/documentation/2.0/configuration
if unquoted
include
@ start of key followed anything other single quoted string, invalid , error should generated.no substitutions allowed, , argument may not unquoted string or other kind of value.
tried:
able substitution done property not
include
thismy.prop="override."${?application.mode}".conf"
the above outputs
override.dev.conf
ifapplication.mode=dev
if have below not working , suppose expected per documentation reference.
include "override."${?application.mode}".conf"
expected above include/override props in file named
override.dev.conf
question:
- should future enhancement or expected out of it?
- what other ways implement wanted?
any appreciated.
i prefer override globalsettings.onloadconfig
described in playframework 2 load different config according current mode. done in scala should possible in java well.
it lets overload configurations in nice way without need start application command line arguments, still start app play run
, play start
, etc.
you should able use method if change override.qa.conf
override.test.conf
since qa
not known mode in play.
all shared settings in application.conf
, override in other ones.
Comments
Post a Comment