Configuration File: config.cf
ML Specific Configuration File: config.cf
You can customize each ML differently.
&fml4; and &fmldevel; are same in this point.
In the case of &fml4;, there is a config.ph in ML home directory,
$DIR (e.g. /var/spool/ml). This "config.ph" file is a perl script.
There is one configuration file (config.cf) in &fmldevel;, too.
But the format is different. The format is like this:
variable = value
.
It is similar to postfix or .ini files.
It is similar to a perl module. You can write perl codes after =cut line.
Problems in &fml4;
The configuration file of &fml4;, config.ph, is a perl script.
Perl script is good for human editing but
it is not suitable for configuration tools.
It implies it is difficult to prepare configuration tools for config.ph.
So, in &fml4; two files, cf and config.ph are used.
It is similar to the conversion from .mc to .cf in sendmail.
The use of cf is suitable for configuration tools but introduces
another difficulty such as inconsistency between cf and config.ph
since human may edit config.ph but forgets editing cf. So, &fmldevel;
introduces only one configuration file.
It is a new format which is similar to Postfix main.cf.
config.cf Format
The format of "config.cf" is "variable = value syntax".
If plural values are required, space or "\n\s" is a separator.
variable = value
valiable = value1 value2 value3
variable = value1
value2
value3
The syntax of files with the suffix .cf e.g.
/etc/fml/main.cf
, default_config.cf,
is same.
$variable at the right hand is expanded.
For example,
a = value1
b = $a/value2
is expanded to
a = value1
b = value1/value2
.
The variable expansion is done at the last.
So, the following definitions
a = value1
b = $a/value2/$c
c = value3
a = value4
are expaned to
b = valu4/value2/value3
since the last $a overwrites the previous one.
Extension To Postfix Style
variable += value
variable -= value
is used for adding or removing the specific value.
x = a b c d
x -= b
becoms
x = a c d
.
Another case,
x = a b c d
x += e
becomes
x = a b c d e
.
Overload Variables In config.cf
Overloading of .cf files is possible.
It overwrites variables.
It enables separation of configuration files e.g.
the default file,
the host specific file,
the domain specific file,
and
ML specific file.
&fml8; reads these files sequentially. At the last, &fml8; expands
variables when variable reading is requested.
Modifying/Adding Variables
After All Configuration Files Have Been Loaded.
The variable expansion is always done.
If some value with $ is added to some variable,
the next reading operation
tie() operation of perl
causes variable expansion.
For example, set
$config->{ key } = '$ml_home_dir/value';
here.
The next read operation e.g.
$config->{ another_key }
(where the key is any) evaluates the variable expansion.
Internal Of Variable Expansion
%_fml_config hash holds pairs of key and value.
The format is $dir/$file in this hash, it is not expanded.
get() returns the value of %_fml_config_result.
The value in this hash is after the variable expansion.
The variable is expanded in calling get() method.
Variable List (Alphabetical Order)
&var.table.list.variables;
Variable List (Class Based)
&var.table.class.variables;
Recipes
What functions are proper used in config.cf file ?
Use methods of $curproc (in hooks).