Version 4, last updated by Richard Dallaway at June 11, 2010 UTC
When your Lift application runs it does so with a specific “run mode”. A run mode can be used to change the behaviour of your application in different environments, e.g., development v. production.
There are six run modes:
- development
- test
- staging
- production
- pilot
- profile
The default run mode is development.
This wiki article outlines the differences between the different run modes, and shows how to set and use the run mode.
Setting the run mode
The run mode is controlled via the run.mode system property, and so can be set via a JVM parameter: -Drun.mode=production (for example)
Accessing the run mode
Props.mode returns RunMode enumeration value
You can use this value if you need to change the behaviour of your application in different run modes, e.g.,:
Props.mode match {
case Props.RunModes.Test => // do what you need to do in test mode
case _ => otherwise...
}
Differences between run modes
The run mode can be used to select a properties file (e.g., for logging control). See Logging for an example.
The following sections details the differences between run modes.
Development
- Snippet errors are shown in the browser
- Comments are retained in XHTML (comments are stripped out in other run modes)
- Non-minified version of JavaScript libraries (e.g., JQuery) are served
Production deployments
Production, Staging and Pilot are all considered to be production-level deployments, and as such have similar differences:
- Templates are cached in memory
Test
- The Mailer logs the message, rather than sending it (since 2.0-M5)