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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With