Application properties
Many applications intentionally expose configuration files to their users so that they may tweak and dictate the
behavior of the application during runtime. In Martini, the
<martini-home>/conf/properties/application.properties
file is one such file. In this file,
we define what we call application properties (sometimes called instance properties) whose values are taken in by
Martini, during start-up or runtime, to instruct how Martini should set itself up or to direct how its
components should operate.
Example: indicate the location of your Solr cores
Take the solr.mode
and solr.url
instance
properties for example; the value of these properties help Martini determine whether to fetch
linked Solr cores from a local, remote, or
cloud instance of Solr and the location of that Solr instance (by providing the Solr instance's
URL).
Package-local properties
Aside from application properties which are global to an instance, we also have properties that are local to a package. These properties work very much like Martini's properties, except their scope is limited to a package.
Application properties are especially handy because they also help externalize Martini's configuration
properties, allowing you to run Martini in different modes or environments without having to do much except for
modify the <martini-home>/conf/properties/application.properties
file.
You can choose whether to use development or production environment-specific package properties
Packages allow you to have multiple .properties
files. For testing purposes, you can have one .properties
file
specifically for development environments and another for production environments in each of your packages. You can
tell Martini which one to use via the package.properties.prefix
instance property.
To help you easily go back to using the original configured application properties, and to help make
upgrading easier, Martini allows you to leave the standard application.properties
file
untouched and define values you want to change in an override file. If you would like to restore properties back to
their original state, simply remove them altogether from the override file.
By default, the override file is named <martini-home>/data/override.properties
. Add a property to the
override file with the same key as the property in the main .properties
file to have Martini use the overridden
value instead.
What if I want to change the name of the override.properties
file?
If you want to use an override file with a different name or location, you must specify the new file via
a system property called integrate.override.properties
.
To create a system property, look at the toro-martini
(if you're using macOS or Linux) or toro-martini.bat
(if you're using Windows) file. There are placeholders there and comments that tell you where to add the
configuration parameters. These files are in the <martini-home>/bin/
directory.
Restarts may be required
Changes you make in the application .properties
file may not reflect immediately unless you restart Martini
or reload the properties via the UI. It's a good practice to restart Martini whenever
making application-wide property changes.
Backwards compatibility
While Martini's application properties have been renamed in v1.1, the use of legacy keys is still supported. Martini will automatically map legacy keys to their corresponding new key upon start up.
Editing application properties
There are many ways to modify an instance's application properties:
- Directly editing the application
.properties
file via the file system - Using the CLI tool
- Using the REST API
- Via the Martini IDE
- Using the Martini Runtime Admin UI
Via Martini IDE
Editing via the UI
Using any of Martini's editors to edit the application.properties
file automatically
pushes changes to the underlying override.properties
file.
If the value has not changed from what is set in the default,
its entry will be removed in the override.properties
file.
The override.properties
file needs to exist in order to trigger this behavior.
To modify application properties using Martini Desktop, right click the instance whose
application properties you want to modify and then click Edit Martini Properties from the appearing context menu.
The <martini-home>/conf/properties/application.properties
editor will open.
Another way to access the application.properties
file is by locating the conf
directory in the core
package
(visible in the Navigator view), and then double-clicking on the .properties
file you wish to edit.
Via the Martini Runtime Admin UI
To open the application .properties
file in the Martini Runtime Admin interface, hover your cursor over the
Configuration menu and then select Martini Properties from the sub-menu that appears. You will be redirected to a
page where you can then edit the file in the editor.
Via the RESTful API
Martini also provides RESTful endpoints for maintaining application properties. This API allows you to remotely do things such as:
- Retrieve application properties
- Add, remove, or update application properties
- Reload application properties