[英]how do I use grails.serverURL in config.groovy?
I changed some lines in my config.groovy to this: 我在config.groovy中更改了一些行:
// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
development {
grails.serverURL = "http://localhost:8099/${appName}"
}
test {
grails.serverURL = "http://localhost:8080/${appName}"
}
}
But when I do run-app
it still gives me 但是,当我
run-app
它仍然给了我
Server running. Browse to http://localhost:8080/myProject
Is there somewhere I need to tell it to use config.groovy? 有什么地方我需要告诉它使用config.groovy吗? Why won't it go on 8099?
为什么不进8099?
By default grails run-app always runs on port 8080. The Config.groovy settings don't effect this. 默认情况下,grails run-app始终在端口8080上运行.Config.groovy设置不会影响这一点。 To change the port use the -Dserver.port setting on the run-app command.
要更改端口,请使用run-app命令上的-Dserver.port设置。 You can find out more about it in the documentation .
您可以在文档中找到有关它的更多信息。
grails -Dserver.port=8099 run-app
grails -Dserver.port = 8099 run-app
That will start your application on port 8099. The Config.groovy values are used when creating absolute links. 这将在端口8099上启动您的应用程序。在创建绝对链接时使用Config.groovy值。
As a follow up, you can change the default port. 作为后续操作,您可以更改默认端口。 However, this modifies the default port for ALL of your Grails projects.
但是,这会修改所有Grails项目的默认端口。
Edit the following line in $GRAILS_HOME/scripts/_GrailsSettings.groovy (approximately line 92): 编辑$ GRAILS_HOME / scripts / _GrailsSettings.groovy中的以下行(大约第92行):
serverPort = getPropertyValue("server.port", 8080).toInteger()
serverPort = getPropertyValue(“server.port”,8080).toInteger()
Another option would be to set the port for each of your applications. 另一种选择是为每个应用程序设置端口。 You can do this by adding the following setting to Build.config :
您可以通过将以下设置添加到Build.config来执行此操作 :
grails.server.port.http = 8081
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.