Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i set up a grails environment variable

I'm uploading images in a grails app I'm developing and I want to be able to have an environment variable the determines where these images are. So if I'm working locally it can just pull from /home/MyName/images but once it's in production it will pull from http://images.site.com. How would I do that? I'm assuming i can set up my config.groovy with the variables i'm just not sure how i switch between them or use them in code.

like image 640
TripWired Avatar asked Jan 22 '23 07:01

TripWired


1 Answers

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

environments {
   foo {
       setting = "bar"
   }
}

It's all in the docs, have a look at Environment and Config.

like image 85
armandino Avatar answered Feb 05 '23 15:02

armandino