Manage application.conf in several environments

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.

时间: 2024-10-21 16:25:49

Manage application.conf in several environments的相关文章

[Python] Manage Dependencies with Python Virtual Environments

Virtual Environments ensure that dependencies from one Python application don’t overwrite the dependencies of another application. In this lesson, you will learn how to create a virtual environment, switch between virtual environments, and manage dep

[React] Use React Context to Manage Application State Through Routes

We’ll create a Router component that will wrap our application and manage all URL related state. We’ll see how we can use React’s built in context mechanism to pass data and functions between components without having to pass props all the way down t

[Javascript] Manage Application State with Immutable.js

Learn how Immutable.js data structures are different from native iterable Javascript data types and why they provide an excellent foundation on which to build your application's state. Instead of them being mutable, they're always immutable, meaning

Put your application in production

Here some simple tips to optimize your application for production. Configure your application.conf First off, the best way to specify production mode is to give a specific ID to your production framework. Let’s pick production as an example. Refer ma

PlayFramework 生产模式下 play Application secret not set 那点事

最近在将play工程通过activator dist开发模式部署到linux服务器上,部署后 打开 localhost:9000 出现 Your new application is ready. 到此本以为一起正常.但是,访问一个有写session数据的页面时,控制台打印了错误日志: play Application secret not set ,play也用了很长世间,对这个错误却没有碰到过,于是根据提示查看了配置文件application.conf, 发现和之前创建的有点区别,这是较早之

Test your application

Creating automatic test suites for your application is a good way to make it robust. It allows you to work in a very agile way. Play tests are built using JUnit 4 or Selenium depending what you want to test. Writing tests The tests must be created in

kafka和zookeeper

1.Kafka入门教程 1.1 消息队列(Message Queue) Message Queue消息传送系统提供传送服务.消息传送依赖于大量支持组件,这些组件负责处理连接服务.消息的路由和传送.持久性.安全性以及日志记录.消息服务器可以使用一个或多个代理实例. JMS(Java Messaging Service)是Java平台上有关面向消息中间件(MOM)的技术规范,它便于消息系统中的Java应用程序进行消息交换,并且通过提供标准的产生.发送.接收消息的接口简化企业应用的开发,翻译为Java

Oracle 11gR2 RAC 新特性说明

最近接触了一下Oracle 11g R2 的RAC,发现变化很大. 所以在自己动手做实验之前还是先研究下它的新特性比较好. 一.    官网介绍 先看一下Oracle 的官网文档里对RAC 新特性的一点说明. Oracle Database 11g Release 2 (11.2.0.2) New Features in Oracle RAC http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/whatsnew.htm#CHDJ

DTrace to Troubleshoot Java Native Memory Problems

How to Use DTrace to Troubleshoot Java Native Memory Problems on Oracle Solaris 11 Hands-On Labs of the System Admin and Developer Community of OTN by Wang Yu, Vincent Liu, and Gary Wang This lab will introduce the basic concepts of DTrace and provid