2. Selecting a data source

Since we have two different datasources, we need to be able to choose which one to actually use. The configuration system in RIFE makes this rather easy to control, we just add a configuration parameter that indicates which datasource has to be used. The database code can then read that parameter and do the right thing depending on its value. After adding the datasource parameter, our rep/config.xml file should look like this:

Example 7.3. Selecting a data source through the configuration system

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE config SYSTEM "/dtd/config.dtd">
 
<config>
  <param name="DISPLAY_TITLE">Friends of Mikael</param>

  <!-- Add a DATASOURCE parameter: -->
  <param name="DATASOURCE">postgresql</param>
      
</config>

The new parameter is called DATASOURCE, and should be set to the name of the source to be used.