Typesafe Conf 'include' syntax too restrictive

25 views
Skip to first unread message

Jordan Messec

unread,
Jan 17, 2017, 4:53:20 PM1/17/17
to Play Framework
I apologize if this is the wrong place for this, but I wasn't sure where might be a better fit. Since Play uses the Typesafe config format I hope someone here can help/point me to a better place to put this.

The syntax for a configuration file allows use of an include statement. The format is as follows:
include "someabsolutepathorfileintheclasspath"

or
include file("/some/absolute/quotedstringpath")


However, as applications may be run on different systems it is often convenient to find files not on the classpath as relative to the $HOME and or ~ directory. As far as I can tell this is not possible. As far as I can tell String interpolation is not supported, use of ~ does not seem to resolve, and String concatenation as well as substitution are not options because the syntax demands a quoted string.

For examples:  
include file("~/Documents/additional.conf")
include file
(${HOME}/Documents/additional.conf)
include file
(${HOME} + /Documents/additional.conf)
location
= ${HOME} /Documents/additional.conf
include file
(location)
location2
= {$HOME} + /Documents/additional.conf
include file
(location2)
Unfortunately none of these successfully includes the additional.conf file.

In our use case we have a non normal directory structure, so we are already forced to use the -Dconfig.resource option to specify the main config file. We want that config file to reference a non packaged configuration file (additional.conf) that includes sensitive info, such as database credentials. This additional.conf file is a json blob, which is used by other applications, and therefore we cannot instead use -Dconfig.resource to reference additional.conf and then finish additional.conf with include "main.conf" because this syntax is not supported by the other applications.

As it stands our only options are to hard code the location of the additional config, or keep two copies of the additional config, one for use with Typesafe and one for all other applications.

Reply all
Reply to author
Forward
0 new messages