-
Notifications
You must be signed in to change notification settings - Fork 0
ProductionConfiguration
When running an application in production mode you can override any configuration. This section covers the more common use cases.
All these additional configurations are specified using Java System properties and can be used directly if you are using one of the start script generated by Play.
You can provide both HTTP port and address. The default is to listen on port 9000 at the 0.0.0.0 address (all addresses).
$ start -Dhttp.port=1234 -Dhttp.address=127.0.0.1
Note that these configuration are only provided for the default embeded Netty server.
You can specify any JVM arguments to the start script. Otherwise the default JVM settings will be used:
$ start -Xms128M -Xmx512m -server
The default is to load the application.conf file from the classpath. You can specify an alternative configuration file if needed:
It will search for an alternative configuration file in the application classpath (you usually provide these alternative configuration files into your application conf/ directory before packaging).
$ start -Dconfig.resource=prod.conf
You can also specify another local configuration file not packaged into the application artifacts:
$ start -Dconfig.file=/opt/conf/prod.conf
You can also specify a configuration file to be loaded from any URL:
$ start -Dconfig.url=http://conf.mycompany.com/conf/prod.conf
Note that you can always reference the original configuration file in a new
prod.conffile using theincludedirective, such as:include "application.conf" key.to.override=blah
## Overriding specific configuration keys
Sometimes you don't want to specify another complete configuration file, but just override a bunch of specific keys. You can do that by specifying then as Java System properties:
$ start -Dapplication.secret=verysecretkey -Ddb.default.password=toto
## Using environment variables
You can also reference environment variables from your `application.conf` file:
my.key = defaultvalue my.key = ${?MY_KEY_ENV}
Here, the override field `my.key = ${?MY_KEY_ENV}` simply vanishes if there's no value for `MY_KEY_ENV`, but if you set an environment variable `MY_KEY_ENV` for example, it would be used.
## Changing the logback configuration file
You can also specify another logback configuration file via a System property.
### Using `-Dlogger.resource`
Specify another loback configuration file to be loaded from the classpath:
$ start -Dlogger.resource=conf/prod-logger.xml
### Using `-Dlogger.file`
Specify another loback configuration file to be loaded from the file system:
$ start -Dlogger.file=/opt/prod/logger.xml
### Using `-Dlogger.url`
Specify another loback configuration file to be loaded from an URL:
$ start -Dlogger.url=http://conf.mycompany.com/logger.xml
- Deploying your application
- Creating a standalone version
- Additional configuration
- Set-up a front-end HTTP server
- Deploying to Heroku
- Deploying to Cloudbees
- Deploying to Cloud Foundry
- Installing Play
- Creating a new application
- Anatomy of a Play application
- Using the Play console
- Setting-up your preferred IDE
- Sample applications