简体   繁体   中英

grails custom development environment

I would like to create a custom grails environment which combines the on-the-fly recompilation feature of the 'development' environment with the persistent database feature of the 'production' environment. However, I do not wish to alter either the development or production environment configurations.

I've tried using the -reloading command line parameter, however, it doesn't appear to have any effect.

It would be great if there were a flag that lived in the conf directory somewhere...

You can create a new environment in the DataSource.groovy file under the section

environment {
developemnt { ...
}
production { ...}

test { ... }

custom{ .. //your code here}

}

with your custom configuration, then

you can run a custom configuration with: grails -Dgrails.env=customEnvironment run-app

https://grails.org/Environments

BTW, if you want your DB to be persistent you only have to change dbCreate to update:

dbCreate = "update" 

in the DataSource file in the environment you want to be persistent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM