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

Can someone provide a concrete example of when the following parameter is used in Config.groovy?

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

What I'm looking for is a use case in which there is no change in the above parameter.

+4
source share
1 answer

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

absolute (optional) - if set to true, there will be a prefix for the destination address of the link with the value grails.serverURL property from Config, or http: // localhost : if it is in the Configuration and does not work during production.

The same attribute is used for link and createLinkTo and there may be several more.

So, if you do not change serverURL in your example, any links that you created using the built-in tags with absolute = true will most likely fail. For example, the following: http://www.changeme.com/ {context} / book

 <g:link controller="book" absolute="true">Book Home</g:link> 
+8
source

All Articles