source: trunk/grails-app/conf/BootStrap.groovy

Last change on this file was 932, checked in by gav, 13 years ago

Configure demo mode.

File size: 1.5 KB
Line 
1import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
2
3class BootStrap
4{
5    def createDataService
6
7    def init = { servletContext ->
8
9        /** Environment specific settings.
10        * Note that (circa grails-1.2.2) if running "test test-app integration:" from "grails interactive"
11        * the correct environment is applied for DataSource and Config,
12        * but for BootStrap (and others) the development environment is applied.
13        */
14        environments {
15            development {
16                log.info "Starting DEVELOPMENT bootstrap."
17                createDataService.ensureSystemAndAdminAccess()
18                createDataService.createBaseData()
19                CH.config.demoMode.enabled = true
20                createDataService.createDemoData()
21                createDataService.startSearchableIndex()
22            }
23            test {
24                log.info "Starting TEST bootstrap."
25                createDataService.ensureSystemAndAdminAccess()
26                createDataService.createBaseData()
27                createDataService.startSearchableIndex(false)
28            }
29            production {
30                log.info "Starting PRODUCTION bootstrap."
31                createDataService.ensureSystemAndAdminAccess()
32                createDataService.createBaseData()
33                if(CH.config.demoMode.enabled) createDataService.createDemoData()
34                createDataService.startSearchableIndex()
35            }
36        }
37
38    } // init
39
40    def destroy = {
41    }
42
43} // end class
Note: See TracBrowser for help on using the repository browser.