Injecting variables into Open-Xchange Middleware configuration deprecated


With version v8.0.0 the Open-Xchange Middleware allows injecting variables into the configuration of the Middleware.

Injecting through tokens

It is possible to specify tokens or placeholders directly in .properties, .yml and .yaml configuration files nested in the /opt/open-xchange/etc directory (and sub-directories respectively); except files:

  • /opt/open-xchange/etc/
  • /opt/open-xchange/etc/

A placeholder begins with the character sequence " and it ends with character sequence ".

The notation accepts an optional source identifier, the actual variable name (required) and an optional default value.

The complete syntax is:

" + <source-id> + "

The source identifier tells from what source to look-up the given variable name and the default value defines the value to use in case no such variable is available in looked-up source.

Supported source identifiers

  • "env" determines that system environment is supposed to be look-ed up for a certain variable name. Furthermore, it is assumed as default in case no source identifier is present.
  • "file" sets that a certain .properties file is supposed to be look-ed up. Moreover, this identifier expects specification of the actual .properties file in surrounding arrow brackets; e.g. "file<>". That .properties file is supposed to reside in the /opt/open-xchange/etc directory or any of its sub-directories.
  • Any other source identifier refers to a programmatically registered instance of com.openexchange.config.VariablesProvider in case a custom source needs to be used.


Given that "PROP1=value1" has been set as environment variable and there is a file /opt/open-xchange/etc/ with content:

# Content of

Specifying a .properties file with the following content:

# "env" used as default source, no default value

# No default value
com.openexchange.test.token2={{env PROP1}}

# "env" used as default source, with "defaultforprop2" as default value

# Fully qualifying notation with source, variable name and default value
com.openexchange.test.token4={{env PROP3:defaultforprop3}}

# Look-up property "com.openexchange.test.value1" in file ""
com.openexchange.test.token5={{file<> com.openexchange.test.value1}}

# Look-up property "com.openexchange.test.value2" in file "", use "foobar" as default value
com.openexchange.test.token6={{file<> com.openexchange.test.value2:foobar}}

The result used by Middleware would be:

--> Use value "value1" from environment variable "PROP1"

--> Use value "value1" from environment variable "PROP1"

--> No such environment variable "PROP2", therefore use default value

--> No such environment variable "PROP3", therefore use default value

 --> Read "mytokenvalue" as value for "com.openexchange.test.value1" from file ""

--> Since no such property "com.openexchange.test.value2" available in file "", the default value is used