Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refer to one configuration variable from other configuration variable inside Config.groovy

For example:

Config.groovy:

// ...
grails.variable1 = "a"
grails.varibale2 = "${grails.variable1}bc"
//...

UPDATE 1

Way shown above works with grails 2.2.3. For older versions of grails please use solution @tim_yates suggested

like image 837
Archer Avatar asked Jan 12 '23 12:01

Archer


1 Answers

You need to declare a variable:

def rootVar = 'a'
grails.variable1 = rootVar
grails.varibale2 = "${rootVar}bc"

Or you might be able to do it via a closure (not tested):

grails.variable1 = 'a'
grails.varibale2 = { -> "${grails.variable1}bc" }()
like image 200
tim_yates Avatar answered Jan 17 '23 06:01

tim_yates