首页 > 移动平台 > 详细

Manage application.conf in several environments

时间:2015-04-22 13:13:39      阅读:223      评论:0      收藏:0      [点我收藏+]

When you work in a team, different developers will use different configuration keys in theirapplication.conf. For example, the log level, some database configuration… This generally leads to recurrent conflicts when you commit the file using your VCS.

Furthermore, different deployment environments – e.g. dev, test, staging and production – need different configurations.

The framework ID

To resolve this problem, Play allows you to give an ID to each framework installation. Use the play tool’s id command to define this ID:

play id

技术分享

You can then prefix your configuration keys with the framework ID for which the configuration option is intended:

application.name=Cool app
application.mode=dev
application.log=INFO
 
# Configuration for gbo
%gbo.application.log=DEBUG
%gbo.db=mem
 
# Configuration for src
%scr.http.port=9500
 
# Production configuration
%prod.http.port=80
%prod.application.log=INFO
%prod.application.mode=prod

Setting the framework ID from the command line

You can specify the framework ID to use for a particular command directly from the command line. For example to run an application in production mode you can use:

play run --%production

with these lines defined in the application.conf file:

application.mode=dev
%production.application.mode=prod

It should be compatible with all commands using the framework ID information. The default ID is still defined using the play id command.

By the way, play test is then equivalent to:

play run --%test

Continuing the discussion

Now we shall move on to Production deployment.

Manage application.conf in several environments

原文:http://www.cnblogs.com/zhiji6/p/4446857.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!