Using ConfigSlurper Scripts in Grails

In Java .properties files are used to configure an application. You can use similar notation to configure Grails applications as well.
A sample appName-config.groovy file that sets up the configuration items that we need.

abtesting {
amazon = new Double(0.5)
ebay = new Double(0.5)
}

A sample function in a controller that will access the configuration properties and modify them.

def abtesting = {
def propValue = grailsApplication.config.abtesting.amazon
println propValue


grailsApplication.config.abtesting.amazon = new Double(1.0)
println grailsApplication.config.abtesting.amazon
}

This code produces the following output:
>> 0.5
>> 1.0