Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Config.groovy in Grails: environments.production.grails.serverURL

Tags:

grails

Can anyone give a specific example of when the following setting in Config.groovy is used?

// set per-environment serverURL stem for creating absolute links
environments {
    production {
        grails.serverURL = "http://www.changeme.com"
    }
    ...
}

What I am looking for is a use-case where not changing the above setting will fail.

like image 208
knorv Avatar asked Mar 01 '23 22:03

knorv


1 Answers

It is used by some of the built-in Tag Libraries. For example, the createLink tag has an absolute attribute that can be set:

absolute (optional) - If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost: if no value in Config and not running in production.

Same attribute is used for the link and createLinkTo tags and there might be a few more.

So if you don't change the serverURL in your example, any links you create using the built-in tags specifying absolute=true will probably fail. For example, the following would resolve to http://www.changeme.com/{context}/book

<g:link controller="book" absolute="true">Book Home</g:link>
like image 146
John Wagenleitner Avatar answered Apr 09 '23 13:04

John Wagenleitner