Configuration Introduction

Based on the type of configuration information, Sahana has different places to place configuration information as follows:

1. /conf/ - The main system configuration file 
2. /mod/<module>/ - The module file configuration
3. Database config table

By default 2) overrides 1) and 3) overrides 2). The database is normally considered the best place to keep the changed configuration especially when Sahana is expected to be deployed in a cluster environment. This way the administrator does not have to ensure any changes to the config file get propagated to every node of the cluster.

Adding a configuration value

All you have to do to register a configuration value in Sahana is to declare it in your module file. example:

$conf['shn_mymodule_configid'] = "value";

Please use the naming convention of shn_<mod abbreviation>_<config id> to prevent conflict with other module configuration variables.

Modifying a config value through the Admin UI

Once you declare a configuration value you can modify it in the Administration→Config Values Section. Any changes are updated in the database and the individual files do not get changed. You can modify a whole range of things including the name of the module, weather it is enabled/visible and other based on what the module writer provides for modification.

Directly modifying a config value in the database

It is recommended that module writers store all their configuration information either in the file or in the database. For the module writer who would like to directly modify the config value in the database especially if they have an admin page for this purpose the shn_config_database_update() function is available. It's typical usage is given below:


QR Code
QR Code dev:configuration (generated for current page)