Grails

Allow parameters like server.port to be configurable in Config.groovy

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.0-RC1
  • Fix Version/s: 1.3 RC2
  • Component/s: Configuration
  • Labels:
    None

Description

As far as I know parameters like server.port can only be specified on the command line. It would be nice if they could also be specified in Config.groovy so that they dont have to be specified on the command line every time.

This was particularly a problem when I tried to integrate Grails with Hudson (see thread http://www.nabble.com/Regression-Testing%2C-Static-Analysis-and-Continuous-Integration-tf4815863.html ), since somehow the command line parameters don't get picked up when specified from Hudson.

Activity

Hide
John Haren added a comment -

I'd also like to be able to just set it in an app's config.groovy. However, for the OP, you can also change the default in $GRAILS_HOME/scripts/Init.groovy with the line:

serverPort = System.getProperty('server.port') ? System.getProperty('server.port').toInteger() : 8081
Show
John Haren added a comment - I'd also like to be able to just set it in an app's config.groovy. However, for the OP, you can also change the default in $GRAILS_HOME/scripts/Init.groovy with the line:
serverPort = System.getProperty('server.port') ? System.getProperty('server.port').toInteger() : 8081
Hide
Graeme Rocher added a comment -

this is already possible

Show
Graeme Rocher added a comment - this is already possible
Hide
Jerry Shea added a comment -

But if I put grails.server.port.http=80 in my Config.groovy it does not take effect. I can only make it work if I pass it in using -D when I run-app

Show
Jerry Shea added a comment - But if I put grails.server.port.http=80 in my Config.groovy it does not take effect. I can only make it work if I pass it in using -D when I run-app
Hide
Colin Harrington added a comment -

you are able to specify this in BuildConfig.groovy

grails.server.port.http=8081

Show
Colin Harrington added a comment - you are able to specify this in BuildConfig.groovy grails.server.port.http=8081
Hide
Jerry Shea added a comment -

Excellent - thanks.
BTW, Grails committers, Config.groovy should refer to ${grails.server.port.http} instead of hardcoding 8080. I would attach a patch JIRA but doesn't give me that option, and it is a trivial change

Show
Jerry Shea added a comment - Excellent - thanks. BTW, Grails committers, Config.groovy should refer to ${grails.server.port.http} instead of hardcoding 8080. I would attach a patch JIRA but doesn't give me that option, and it is a trivial change

People

Vote (8)
Watch (6)

Dates

  • Created:
    Updated:
    Resolved: