global_config.rb

Path: app/models/global_config.rb
Last Update: Tue Mar 01 07:46:08 +0000 2011

This class is used for storing the global configuration. A choice has been made here to store the configuration in the database rather than in a file.

This has two advantages:

  1. It allows one to change configuration only in one place (when multiple servers use one db) and during runtime.
  2. Rails objects can be stored as values in the configuration.

This global configuration class actually does a little more than just ‘storing’: It also initializes/creates and sets some things. There are a number of steps that are undertaken by this class:

The database is filled with (from config/config.rb):# :

  1. basic settings (just filling db)
  * main_page_tag, title line, header keywords and description, minima and
    maximums and some other things (minor/detailed)
  1. indirect settings (calculated based on basic)
  * sets the daily fraction based on the half-life...
  1. user settings (depend on basics)
  * creates anonymous and administrative users
  1. group settings (depend on users)
  * creates the public user- and peer-group

After each step the GlobalConfig is saved so it can be used by the next step. At the end some finishing touches are applied like creating prefs-profiles for the system users…

Required files

config/config  

[Validate]