1
A
回答
3
如果要通过环境变量只是增加你的属性是这样的:
environments {
production {
grails.serverURL = "http://www.changeme.com"
grails.dbconsole.enabled = true
grails.dbconsole.urlRoot = '/admin/dbconsole'
}
development {
grails.serverURL = "http://localhost:8080/${appName}"
}
test {
grails.serverURL = "http://localhost:8080/${appName}"
}
}
然后让你的变量是这样的:
${grailsApplication.config.grails.serverURL}
要切换环境,请使用以下命令:
grails run-app // runs with the default "development" data source
grails dev run-app // runs with the "development" data source
grails run-war // runs with the production data source
grails -Dgrails.env=mycustomenv run-app // specific a custom environment
grails test run-app // runs with the test data source
+0
Grails文档不建议使用“grails run-app”命令用于生产。请参阅:http://grails.org/doc/latest/guide/deployment.html –
+0
谢谢,编辑改为建议的'grails run-war'来代替。 –
+0
有没有办法使用不同的文件而不是范围样式? –
相关问题
- 1. 构建VISUAL STUDIO 2008 C++项目系统
- 2. Java构建系统选项
- 3. 项目结构和构建系统的.NET连接到Git的
- 4. Maven无法构建Grails项目 - AsyncException,RegexSupport?
- 5. 使用Maven构建Grails项目Issue
- 6. 推荐使用需要编译的静态资产来为项目构建项目结构和构建系统?
- 7. PHP构建系统
- 8. 如何构建一个使用sbt作为构建系统的项目?
- 9. Xcode外部构建系统项目无法找到wchar.h
- 10. 如何为Visual Studio 2010项目使用Omake构建系统
- 11. 用于Visual Studio项目的独立构建系统
- 12. 如何构建在线项目监控系统
- 13. 什么是Angular2项目的良好构建系统?
- 14. 为嵌入式C/C++项目构建系统
- 15. 为使用C和Haskell的项目构建系统
- 16. 如何组装一个多项目的蚂蚁构建系统
- 17. 设置项目相关的构建系统变量
- 18. 将项目迁移到gradle构建系统错误
- 19. 用于多语言项目的构建系统
- 20. Grails项目结构概述
- 21. 访问构建系统从另一个构建系统2
- 22. Grails构建自动化,代码审查和部署系统
- 23. 在grails项目中使用js访问文件系统
- 24. 从Maven项目构建依赖关系?
- 25. Gradle子项目构建依赖关系
- 26. Intellij创建Grails项目
- 27. grails 3创建子项目
- 28. Grails重建整个项目
- 29. GNU构建系统问题
- 30. linux构建系统工具
它们都是内置功能,你是什么意思“不同的环境”?你的意思是客户端,服务器端,都? –
我的意思是发展与生产。例如在dev模式下,密码可以是“1234”,在dev“DFG54 ^&HGFGV”中,但是变量代码是相同的......类似于pass =“{properties.pass}”; –
好的,你喜欢在实时系统上编辑>保存>刷新? –