How To Add Configuration
Making a Feature Configurable
Run-time Configuration Settings
Some parts of Mifos can be configured while a Mifos instance is deployed and running. A user interface should exist for run-time settings. For example, "Roles and Permissions" can be found by clicking on the "Admin" tab. The configuration is stored in the database.
Install-time Configuration Settings
Application-wide settings
Some parts of Mifos must be configured at install time. Changing them requires redeployment. The default values for these settings reside in the file
application/src/main/resources/org/mifos/config/resources/applicationConfiguration.default.properties
This is known as the "application-wide configuration file". Developers should edit this file as necessary. Mifos specialists should create a file called
applicationConfiguration.custom.properties
and place this file in the application server classpath. Individual configuration settings may be overridden as necessary.
Apache Commons Configuration is used to access the properties files. ConfigurationManager
is the entry point for this library.
Trap Doors
Some settings are "trap doors", and can only be changed once. This is usually because enabling or disabling them leads to database changes that are not easy to undo. If this is the case for a particular setting, it should be made clear in a comment in applicationConfiguration.default.properties
.
Tables previously used for configuration like config_key_value_integer
and customer_state
are now used to store state of these values, so they are not able to be unset in cases where database corruption would result.
For code examples, see ProcessFlow.SavingsPendingApprovalStateEnabled
in the ProcessFlowRules
class or ClientRules.GroupCanApplyLoans
in the ClientRules
class.
Fully adjustable
Other settings in the application-wide configuration file can be changed at any time, and will take effect as soon as Mifos is redeployed. For example: ClientRules.NameSequence
.
Unit Tests
Unit tests should be created to test logic beyond what is covered in Apache Commons Configuration. TestClientRules
is a good example.
Historical Reference
As part of improving the Mifos configuration process install-time configuration settings were migrated from the database into properties files. The following content on configured values is included only for historical reference.
Deprecated content
This page describes how to add database based configuration information to Mifos.
Currently there is support for generic integer based configuration parameters in Mifos. This functionality will most likely be refined or refactored in the future, but the current usage is as follows.
Say you want to add a configuration parameter "EnableMyFeature" that is either true or false.
- Decide on the name (key) that you would like to use to refer to the parameter. We'll use "myFeatureIsEnabled" for this example.
- Add a database entry to latest-data.sql for your entry with a default value of false (0) as follows:
INSERT INTO CONFIG_KEY_VALUE_INTEGER(CONFIGURATION_KEY, CONFIGURATION_VALUE) VALUES ('myFeatureIsEnabled',0);
- Follow the standard procedure for database upgrades described in DatabaseStandards to include your new configuration value in a new databaes version.
- You can access the configuration value using the getConfigurationKeyValueInteger method defined on the ConfigurationPersistence class. (see TestConfigurationKeyValueInteger for sample code which uses these methods)