Reusing Grails variables inside Config.groovy

前端 未结 2 889
逝去的感伤
逝去的感伤 2021-01-13 14:06

In my Config.groovy I have:

// Lots of other stuff up here...

environments {
    development {
        myapp.port = 7500
    }
    production {         


        
2条回答
  •  花落未央
    2021-01-13 14:54

    Another way is to simply use variables within your config file like this:

    def appPort = 7500
    
    environments {
        production {
            appPort = 7600
            myapp.port = appPort
        }
    }
    
    fizz {
        buzz {
            foo = "Port #$appPort"
        }
    }
    

    And also, you don't need to send the -Dgrails.environment=development when you execute the run-app, it's the default one.

提交回复
热议问题