Manage application.conf in several environments

Source: Internet
Author: User

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

Furthermore, different deployment environments–e.g. Dev, test, staging, Production–need different.

The Framework ID

To resolve the problem, Play allows to give a 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 and the framework ID for which, the configuration option is intended:

application.name=Cool appapplication.mode=devapplication.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 of the to use for a particular command directly from the command line. For example to run a application in production mode can use:

play run --%production

With these lines defined in the application.conf file:

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

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

By the-the-by, play Test was then equivalent to:

play run --%test

Continuing the discussion

Now we shall move in to Production deployment.

Manage application.conf in several environments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.