Resources and configuration

UpCommands
Sitemap
 

During package initialization the following operations will occur:

  • The configuration variable configPaths is defined, it contains ~/.fmail and the packagePath/stdap by default, i.e. the standard main configuration directory and the path to the library of standard actions, predicates and rule sets.
  • The configuration variable pluginPaths is defined, it contains the same paths as configPaths.
  • The main resource file is located and read. The following locations are tried, in the order given: ~/.fmail/rc, ~/.fmail.rc and ~/.fmailrc.
  • The first directory in configPaths is seen as the mainConfigDir and made accessible through its own configuration variable.
  • The configuration is read, i.e. each file having the suffix '.cfg', in any of the directories listed in configPaths. It is allowed to add paths to configPaths from within a configuration file. This will cause the system to check that directory too, for more configuration files.
  • The last part of the configuration read in is the persistent state of the appropriately defined configuration variables, as stored in the file mainconfigDir/persistent.state.
  • All plugin modules are initialized, by reading all files with either '.rules' or '.tcl' as their suffix, in any of the directories listed in pluginPaths. It is expected that the first define new rule sets. The latter should define actions and predicates required by the plugins and their rule sets.

The following four commands are available for access to and manipulation of configuration variables.

Configuraton commands
Subcmd Description
::fmail::cfgDefine
key persistent {initialvalue {}}

Defines a new configuration variable, possibly with an initialvalue. The last value held by it will be written into the persistent state of the package, if the variable was defined that way (<persistent> == 1).

<key> is the name of the new variable.

<persistent> was explained above.

<initialvalue> may contain a default value for the variable.

Example

::fmail::cfgDefine spamblock/localTarget    0 
	    
::fmail::cfgGet
key

Retrieves the current contents of the configuration value whose name was stored in <key>.

Example

# In an action, i.e. a rule interpreter. Beware of the case.
set vdb   [cfgget vacation/db]
set vmsg  [cfgget vacation/msg]
set vfrom [cfgget vacation/from]
	    
::fmail::cfgSet
key value

Sets the current contents of the configuration value whose name was stored in <key> to the contents of <value>.

Schedules a write of the persistent state during exit if the changed variable was declared as persistent.

::fmail::cfgLappend
key value

Appends the contents of <value> to the current contents of the configuration value whose name was stored in <key>. List semantics!

Schedules a write of the persistent state during exit if the changed variable was declared as persistent.


© Andreas Kupries
Last update at Thu Nov 11 21:48:40 MET 1999