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的更多相关文章

  1. [Python] Manage Dependencies with Python Virtual Environments

    Virtual Environments ensure that dependencies from one Python application don’t overwrite the depend ...

  2. [Javascript] Manage Application State with Immutable.js

    Learn how Immutable.js data structures are different from native iterable Javascript data types and ...

  3. [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’ ...

  4. Put your application in production

    Here some simple tips to optimize your application for production. Configure your application.conf F ...

  5. Test your application

    Creating automatic test suites for your application is a good way to make it robust. It allows you t ...

  6. Spring Boot Reference Guide

    Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch,  ...

  7. Spring Boot文档

    本文来自于springboot官方文档 地址:https://docs.spring.io/spring-boot/docs/current/reference/html/ Spring Boot参考 ...

  8. Deployment options

    Play applications can be deployed virtually anywhere: inside Servlet containers, as standalone serve ...

  9. Logging configuration

    The Play logger is built on Log4j. Since most Java libraries use Log4j or a wrapper able to use Log4 ...

随机推荐

  1. Android 6.0 权限申请辅助 ----PermissionsHelper

    Android 6.0 权限申请辅助 ----PermissionsHelper 项目地址:https://github.com/didikee/PermissionsHelper Android 的 ...

  2. Win10+VS2015+EF6.0+MySQL5.6+MVC环境部署和排错

    本来已经好几个月不弄专业了,今天一哥们问我问题的时候重新捣鼓了一下,就做个文档供后来人参考吧~ 1.首先安装MySQL 5.6 安装很简单我就不说了,你参考下:http://jingyan.baidu ...

  3. Ruby之基本数据类型(三)

    前言 上一节我们介绍了常量以及变量的用法,这一节我们开始来介绍Ruby中的一些基本类型. 数值类型(Fixnum.Bignum.Float) Ruby的数值类型包括整数和浮点数.整数包括Fixnum和 ...

  4. 窥探Swift系列博客说明及其Swift版本间更新

    Swift到目前为止仍在更新,每次更新都会推陈出新,一些Swift旧版本中的东西在新Swift中并不适用,而且新版本的Swift会添加新的功能.到目前为止,Swift为2.1版本.去年翻译的Swift ...

  5. iOS开发之使用Storyboard预览UI在不同屏幕上的运行效果

    在公司做项目一直使用Storyboard,虽然有时会遇到团队合作的Storyboard冲突问题,但是对于Storyboard开发效率之高还是比较划算的.在之前的博客中也提到过,团队合作使用Storyb ...

  6. Objective-C中的集合类

    下面详细的介绍Objective-C中的集合类以及每个集合类的用法,学过其他面向对象编程语言的小伙伴们看到OC的集合类会有种莫名的亲切感,理解起来问题不大,可以类比Java中的集合类去学习. 在Obj ...

  7. csapp2e-chapter2-homework

    一 前言 看了csapp2e第二章,感觉讲的很透彻,理解了一些以前学组成原理没有学懂的东西.这章最让我感觉深刻的还是计算机是怎么实现c语言中的基本数据类型的表示和操作的,这对程序员理解程序无疑是帮助巨 ...

  8. IE滤镜及其使用技巧

    Gradient Filter和AlphaImageLoader Filter 这两个属性是legend IE(IE6,7,8)中的渐变滤镜和透明滤镜,我们先详细介绍下这两个属性的用法,详情 可查看M ...

  9. DG环境数据库RMAN备份策略制定

    DG环境数据库RMAN备份策略制定: 主库(Primary) 全库备份 归档备份 删除历史文件夹 备库(Standby) 删除归档 引用说明 主库(Primary) $ crontab -l 0 1 ...

  10. lamp 环境搭建

    LAMP指的Linux(操作系统).ApacheHTTP 服务器,MySQL(数据库软件)和PHP语言 使用wampserver软件,搭建环境.如下图: 双击程序包,安装最后一步随便选择一个浏览器打开 ...