grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

Grails ignoring serverURL

Open sflohrs opened this issue 1 year ago • 2 comments

Expected Behavior

grails should pick up serverURL from configuration file(s) (compare with: https://github.com/grails/grails-core/issues/10770)

grails-app/conf/application.yml

environments:
    development:
        grails:
           serverURL: http://localhost:7777
    production:
        grails:
           serverURL: http://localhost:9999

To output the value of serverURL change Bootstrap.groovy:

import grails.core.GrailsApplication

class BootStrap {

    GrailsApplication grailsApplication

    def init = { servletContext ->
        println "Grails Server URL: " + grailsApplication.config.getProperty('grails.serverURL')
    }
    def destroy = {
    }
}

Build project: ./gradlew build Run project: java -jar build/libs/serverurl-0.1.war expected output:

Grails Server URL: http://localhost:9999
Grails application running at http://localhost:9999 in environment: production

Actual Behaviour

Grails does pick up the given serverURL only half way and starts on default port 8080:

Run project: java -jar build/libs/serverurl-0.1.war actual output:

Grails Server URL: http://localhost:9999
Grails application running at http://localhost:8080 in environment: production

Steps To Reproduce

  1. environment: grails 5.2.4 groovy 3.0.11 jvm 1.8.0.302

  2. config:

grails-app/conf/application.yml

environments:
    development:
        grails:
           serverURL: http://localhost:7777
    production:
        grails:
           serverURL: http://localhost:9999

Environment Information

No response

Example Application

No response

Version

5.2.4

sflohrs avatar Nov 07 '22 09:11 sflohrs