I’ve punted on this before, and/or hacked around it, but I’d like to solve it properly once and for all.
The question is what to do if I need a URL that changes per environment in a JavaScript module that's part of a Groovy/Grails project
For example, I have a JavaScript module that contains this function:
function init() {
dojox.cometd.init('http://localhost:8082/grails-cometd/cometd'); // This URL changes for prod vs dev
dojox.cometd.subscribe('/queue/advisoryLock', onMessage);
}
grails link tags, etc, don’t work here. Is there a proper Grails/Java way of doing this? I couldn’t find anything…