From PmWiki

V2: ConfiguringCongo

Congo Configuration Management

Congo uses an overly-clever meta-configuration system to control the settings UI, configuration validation during startup, and saving configuration to disk. If you have a piece of Congo you need to make configurable, here's how:

  1. In src/main/resources/com/stonekeep/congo/config/schema/xml/ there is a schema file for the configuration, schema.xml. It's divided into <category> sections, each of which has a list of <entry>s. Each entry defines a single configuration item; use the existing config entries as examples. Create a new category if necessary, and add a new entry for each configuration item. The key attributes will be used to store the config in the file and to provide the config to the rest of the system, so keep track of them.
  2. In any of the Spring context XML files, add a property placeholder using your new key. If you add a configuration entry with key="hello.world", to use the key in Spring, use ${hello.world}.
  3. Redeploy CONGO.

How does this work?

The replacement of ${placeholder}s with values is handled entirely by Spring's PropertyPlaceholderConfigurer. Whenever the configuration is changed via the web UI, validation logic runs against it, then the configuration is saved to a properties file in congo.home (~/.congo/ by default), then the app context is refreshed, which reloads the properties file.

The validation in com.stonekeep.congo.config.schema.xml.SchemaDescriptionValidator? is run at startup by Spring bindings in configurationManagement.xml. If the loaded configuration is valid, the application starts (or restarts) as normal and users can log in. If the configuration is not valid, then the application starts up in a "not configured" mode where most actions redirect the user to the configuration UI, which is temporarily available to unauthenticated users.

Retrieved from http://congo.wiki.stonekeep.com/V2/ConfiguringCongo
Page last modified on December 15, 2008, at 10:10 AM