| Path: | doc/src/config |
| Last Update: | Fri Oct 13 15:35:37 +0200 2006 |
Note: This is not a description for the values that can be configured. Please see the comments in the respective configfile for that. Instead this document is a description of the overall structure and organization of the configuration files.
Dsadmin configfiles are XML, with a root tag named <config> (although this element‘s name is largely irrelevant in practice). Several mechanisms are provided to make their organization easier:
Any XML element (and the subtree defined by it) may be moved to a seperate file. Just add a <include file="(thefilename)"/> in its stead and move the element including its contents to that referenced file. When reading the configfile, all <include> tags are replaced with the root element of the referenced file.
This works with any XML element, both in the root file and all included files (recursively). It makes no difference whatsoever to the application whether any parts are included or what parts are included.
Note: Restrictions (e.g. "readable by root only") apply to all configfiles.
Note: All included files have to be in the same directory as the root file.
Common elements / subtrees can be referenced by other elements by adding an idref="(targetid)" attribute to the referencing element(s) and id="(targetid)" to the referenced one. When reading the configfile, the element containing the "idref" is replaced with the corresponding target element (same element name and matching "id" attribute).
This works with any XML element, both in the root file and all included files (recursively) as well as across included files. It makes no difference whatsoever to the application whether any parts are referenced or what parts are referenced.
If an element X is (a) child of element Y and (b) has an attribute "sticky" (value irrelevant), then it is copied to all other complex child elements of element Y. "Complex" elements are in this context all elements that in turn contain other children (elements or attributes).
The configfile is processed in the following way:
Definition of a command to be exec‘d. Maps to a Dsadmin::SystemCommand. Minimal Example:
<rsync user='mirror'>
<cmdline>/usr/bin/rsync</cmdline>
</rsync>
Full Example:
<rsync user='mirror' group='mirror'>
<cmdline>/usr/bin/rsync -v -a -z</cmdline>
<param>--exclude</param>
<param>.teh suck.avi</param>
<env key='RSYNC_PASSWORD' value='l33th05t'/>
<dir>/srv/mirrors</dir>
</rsync>
The tag name can be anything. user (required) and group (optional) specify as what user/group the command should be executed. cmdline specifies the actual command and optionally some of its parameters. This line is split up via the "Shellwords" library, so you can even use moderately complex strings in there. Even more complex parameters (or just additional ones that you want to pack in a more readable way) can be given with param elements. env elements specify environment variables to be set for the command‘s execution. dir allows to set the desired working directory.
Definition of a filesystem path. Maps to a Dsadmin::SystemPath. Minimal Example:
<templates>
<path>share/dsadmin/templates</path>
</templates>
Full Example:
<web-statisticsfiles user='root' group='root' perm='0640'>
<path>/srv/www/{PROJECTID}/statistics/{DATE}/{FILENAME}</path>
</rsync>
The tag name can be anything. user and group (both optional) specify as what user/group the file should be accessed. perm (optional, default "0644") is the permissions to be used when creating the file. path specifies a path pattern optionally containing placeholders (matching /\{\w+\}/) substituted on each access.