Play framework is joining the Typesafe Stack — More information in the official announcement

Manual, tutorials & references

Browse

Contents

Select the version

Search

Get help with google

Books

Manage application.conf in several environments

When you work in a team, different developers will use different configuration keys in their application.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 id command of the play tool 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

Comments

Use this form to add corrections, additions and suggestions about the documentation on this page. Please ask questions on the play-framework group instead. Support requests, bug reports, and off-topic comments will be deleted without warning.