Groovy config file and the order of property initialisation
I would like to use the ConfigSlurper to read a groovy config file into a ConfigObject.
The configuration file contains common and environment-specific properties as displayed in the example below.
In order to avoid code duplication, I would like to define a common property 'prop1'. The value of the latter depends on property 'prop2' which is initialised later depending on the environment setting.
Regardless of the environment set, variable 'prop1' resolves to 'current env is [:]' which is correct because 'prop2' has not yet been initialised.
Is there a way to defer 'prop1' initialisation until after 'environments' block? Do I have any other option to solve this?