Overriding OpenMRS Default Properties


OpenMRS now supports both build time and runtime properties.

Build Properties

Specify the build properties file by setting an environment variable named:

OPENMRS_BUILD_PROPERTIES_FILE

Note: Use forward slashes in Windows paths instead of backslashes (Java has issues with backslashes)

The most common build properties that can be overwritten are:

### name of generated war file
webapp.name=openmrs
webapp.display.name=OpenMRS
webapp.description=Open-Source EMR for Developing Countries

###Properties for running unit tests with tomcat###
tomcat.home=C:/Program Files/Apache/Tomcat 5.5/
tomcat.server=localhost
tomcat.port=8080
tomcat.manager.url=http://${tomcat.server}:${tomcat.port}/manager
tomcat.username=test
tomcat.password=test
  • Note: Tomcat username/password is not copied into the webapp*


Runtime Properties

These properties are loaded when a webapp is started. Properties are mainly copied into constants files for use in the webapp. The purpose of these runtime properties are a first attempt at a distributable .war file.

In the following descriptions, {WEBAPP NAME} is used in place of your web applications name (the name of the war file you loaded). Often this will be openmrs.

OpenMRS will look for the runtime properties file (in order):

  1. Using the environment variable ''{WEBAPP NAME}''_RUNTIME_PROPERTIES_FILE
  2. User's home directory
    • Windows: %APPDATA%\OpenMRS\''{WEBAPP NAME}''-runtime.properties
    • Linux: ~/.OpenMRS/''{WEBAPP NAME}''-runtime.properties (NOTE: On Linux, in some occasions, it is still necessary to set the ''{WEBAPP NAME}''_RUNTIME_PROPERTIES_FILE environment variable to point to your file in order to get OpenMRS to read it.)
  3. In the current directory — i.e., ./''{WEBAPP NAME}''-runtime.properties

Usually, the runtime properties file should be placed in:

  • Windows: %APPDATA%\OpenMRS\ (e.g., C:\Documents And Setting\username\Application Data\OpenMRS\) with the name ''{WEBAPP NAME}''-runtime.properties
  • Linux: ~/.OpenMRS/''{WEBAPP NAME}''-runtime.properties

The default location can be overridden by creating an environment variable and setting its value to the location of the runtime properties file:

''{WEBAPP NAME}''_RUNTIME_PROPERTIES_FILE = /path/to/runtime/properties/file

Note: Do not use %APPDATA% in your path. OpenMRS will not render it. It is used here as an example


The runtime properties that can be overwritten are:

#
# OpenMRS Runtime Properties file
#
# (comments starting with a pound sign "#" are ignored)

### Database connection properties
connection.username=test
connection.password=test
connection.url=jdbc:mysql://localhost:3306/openmrs?autoReconnect=true

# Allow/Disallow uploading of a module via the web
module.allow_web_admin=false

### Debugging options
hibernate.show_sql=false

###Customization Options
## If the custom setting is a folder, only files contained in the customization will be overwritten
#custom.images.dir=%APPDATA%/OpenMRS/custom/images
#custom.template.dir=%APPDATA%/OpenMRS/custom/template
#custom.style.css.file=%APPDATA%/OpenMRS/custom/style.css
#custom.index.jsp.file=%APPDATA%/OpenMRS/custom/index.jsp
#custom.messages=%APPDATA%/OpenMRS/custom/messages.properties
#custom.messages_fr=%APPDATA%/OpenMRS/custom/messages_fr.properties

### Other
## Set the directory that OpenMRS uses for its application data
## Will be used as base dir for modules, generated reports, etc
## Defaults to C:/Docs&Settings/username/Application Data/OpenMRS for windows
## Defaults to ~/.OpenMRS for *nix
## (As of build 1.2.0.3426)
# application_data_directory=/opt/openmrs

#
##
### The following properties are deprecated as of 1.0.43
### Properties can be modified in the Global Properties section of the webapp
###
###formentry.infopath.output_dir=%APPDATA%/OpenMRS/FormEntry/forms
###formentry.starter_xsn_folder_path=C:/Program Files/Apache Group/Tomcat/webapps/openmrs/formentry/forms/starter
###formentry.infopath.server_url=http://localhost:8080/openmrs
###formentry.infopath.initial_url=http://localhost:8080/openmrs/formTaskpane.htm
###formentry.infopath.taskpane_caption=Welcome!
###scheduler.username=admin
###scheduler.password=test

Actually, the following seems to be the complete list of files that can be customized via runtime properties, along with their default values (taken from org.openmrs.web.Listener.java on 1/25/2007)

custom.template.dir=/WEB-INF/template
custom.index.jsp.file=/WEB-INF/view/index.jsp
custom.login.jsp.file=/WEB-INF/view/login.jsp
custom.patientDashboardForm.jsp.file=/WEB-INF/view/patientDashboardForm.jsp
custom.images.dir=/images
custom.style.css.file=/style.css
custom.messages=/WEB-INF/custom_messages.properties
custom.messages_fr=/WEB-INF/custom_messages_fr.properties
custom.messages_es=/WEB-INF/custom_messages_es.properties
custom.messages_de=/WEB-INF/custom_messages_de.properties

Note: .OpenMRS-build.properties is no longer used and the Example_.OpenMRS-Build.properties wiki page has been deleted.