Configuration file and directive syntax
Configuration directives are usually specified with the directive as the first
word on the line, followed by its parameters.
Capitalisation of the directive name is not significant.
Leading and trailing whitespace is stripped from the line.
Including files in directives
Additional files may be called with an "include file" notation, like this:
|
DirectiveName <includefile
|
Files included from interchange.cfg are relative to the Interchange
instance's installation directory.
Files included from catalog.cfg are relative to the website's home
directory, as defined using the Catalog directive.
For example, a Variable can be initialised from a file like this:
This works well for includes that must be of the highest possible performance.
Rather than using a tag, such as [include], the file's content
can be simply placed in a page with "__VARIABLE__".
The ConfigDir directive can be used to specify the name of
the directory where files will be read from when using the "<file" syntax.
include
Other configuration files can be included in the current one.
For example, common settings can be set in one file:
You can use the following syntax to "include" all files
in a named directory, where the filename ends with "tag":
The above would read all files with names like "foo.tag" or "foo.usertag" etc. (if they exist and are readable),
and parse the content as an Interchange configuration file.
The above would not attempt to open files with names that don't
end with "tag",
such as "foo.tag.old" etc.
Here documents
A here document can be used to spread directive values
over several lines.
The usual Perl "<<MARKER" syntax is used,
except that no semicolon is used to terminate the marker.
The closing marker must be the only text on the line.
No leading or trailing characters are allowed - not even whitespace.
Here is a hypothetical directive,
defined using the here document syntax:
DirectiveName <<EOD
setting1
setting2
setting3
EOD
|
The above example would be equivalent to the following:
|
DirectiveName setting1 setting2 setting3
|
Apache-style container syntax
Configuration directives can be specified using Apache-like syntax.
When using this syntax the configuration value will only take effect
within the defined block.
This syntax has limited use.
The only configuration directive I can think of where this syntax could
be useful is
ParseVariables.
For example:
Variable WEBSITE_ID mywebsite
<ParseVariables Yes>
Message The website ID is __WEBSITE_ID__
include config/__WEBSITE_ID__.cfg
</ParseVariables>
|
ifdef and ifndef
ifdef/endif and ifndef/endif pairs can be used to conditionally
include/exclude parts of the configuration, as follows:
Variable ORDERS_TO kevin@cursor.biz
#
# Set the order address to "somebody" if it currently set to "nobody"
#
ifdef ORDERS_TO eq "nobody@example.com"
Variable ORDERS_TO somebody@example.com
endif
#
# Send all orders for example.com to one address
#
ifdef ORDERS_TO =~ /example\.com$/
Variable ORDERS_TO orders@example.com
endif
#
# Set a default address if one has not been provided
#
ifndef ORDERS_TO
Variable ORDERS_TO webmaster@example.com
endif
ParseVariables Yes
MailOrderTo __ORDERS_TO__
|