How to set up Grails environment variable

I am uploading images to a grails application that I am developing, and I want to have an environment variable that determines where these images are. Therefore, if I work locally, it can just pull out from / home / MyName / images, but as soon as it appears in the production process, it will pull out from http://images.site.com , How do I do this? I suppose I can configure my config.groovy with variables, I'm just not sure how I switch between them or use them in code.

+4
source share
1 answer

Use -Dgrails.env=foo to specify the environment where foo is defined in your configuration file:

 environments { foo { setting = "bar" } } 

Everything in the docs, see Environment and Config .

+9
source

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


All Articles