How can I manually set the GrailsUtil.environment variable in Bootstrap.groovy

While bootstrap.groovy starts GrailsUtil.environment automatically switches to development.

Can someone explain how I can manually change this variable before starting the boot .. ??

Where does it set the default for development in the Grails framework .. ??

Thanks.

+4
source share
1 answer

Your grails environment is indicated on the command line when entering run-app , for example. I do not believe that you can switch the environment setting in Bootstrap.groovy - or any file - at runtime. Instead, you can change it by running grails commands:

-Dgrails.env=production run-app - you can create your own startup environments, just change the value for -Dgrails.env to your custom environment.

Some grails tasks will run by default in a given environment; you do not need to explicitly specify it.

  • run-app - runs in development environment by default
  • test-app - default test environment
  • war - default production environment

More information here: http://www.grails.org/Environments

+13
source

Source: https://habr.com/ru/post/1436265/


All Articles