views:

487

answers:

1

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.

+2  A: 

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.

armandino
Thank you I've been looking for those exact pages.
TripWired