Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i manually set GrailsUtil.environment variable in Bootstrap.groovy

Tags:

grails

At the time bootstrap.groovy is running GrailsUtil.environment is automatically switch to development.

Can any one explain,How can i manually change that variable before bootstrap starts..??

Where it is setting as default to development in grails framework..??

Thanks.

like image 633
Suseendran P Avatar asked Sep 26 '12 01:09

Suseendran P


1 Answers

Your grails environment is specified on the command line when you type run-app, for example. I don't believe you can switch the environment setting within Bootstrap.groovy--or any file--at runtime. Instead, you can change it by how you execute the grails commands:

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

Some of the grails tasks will run in a given environment by default; you don't need to set it explicitly.

  1. run-app -- defaults to run in the development environment
  2. test-app -- defaults to test environment
  3. war -- defaults to production environment

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

like image 200
John Gordon Avatar answered Nov 15 '22 10:11

John Gordon