Sometimes it is needed to deal with non-grails configuration in Grails project, and usually there is problem if you need to use different configuration for different environment.
For example, recently I had to configure Lucene with
So in this case you can hook into Grails and adjust configuration for specific environment via events in
Of course, in different situations you can use different approach and for example, replace it with another file and so on.
For example, recently I had to configure Lucene with
compass.cfg.xml
. And in production it is using MySQL dialect, and in test environment H2.So in this case you can hook into Grails and adjust configuration for specific environment via events in
scripts/_Events.groovy
. For example, in my case I was just deleting custom configuration and using RAM store in test environment, like:eventPackagingEnd = { msg ->
def file = new File("${grailsSettings.resourcesDir}/compass.cfg.xml")
file.delete()
}
Of course, in different situations you can use different approach and for example, replace it with another file and so on.
No comments:
Post a Comment