Config grails.serverURL Get dynamic port

In my Config.groovy file I have a grails.serverURL set for development, but the port is hardcoded to 8080.

Several developers have different ports configured to prevent conflicts with other running applications (e.g. local dev SOA).

What I have tried did not give me happy results.

  • I have installed -Dserver-port=8090

    in my run-app command
  • Link to ${server.port}

    and ${grails.server.port.http}

    line grails.serverURL

How can I reference the value -Dserver-app

for use in Config.groovy?

+3


source to share


1 answer


you can access your system properties with System.getProperty ()

For example start your grails application with

grails -Dserver-app="foobar" run-app

      



Then in Config.groovy:

def ServerApp = System.getProperty("server-app"); //returns "foobar"

      

0


source







All Articles