Configuration Files
===================

Naming
------

    * Components:
        * bareos-dir
        * bareos-sd
        * bareos-fd
        * bareos-traymonitor
        * bconsole

    * $COMPONENT refers to one of the listed Components.

    * Legacy config file (still valid and supported, with some limitation when using the configuration API):
        * $BAREOS_CONFIG_DIR/$COMPONENT.conf

    * $BAREOS_CONFIG_DIR refers to the configuration directory. Bareos Linux packages use "/etc/bareos/".
    * $BAREOS_CONFIG_TEMPLATE_DIR refers to the configuration template directory. Normally on initial install, files from this directory are copied to the $BAREOS_CONFIG_DIR. Bareos Linux packages use "/usr/lib/bareos/defaultconfigs/".

Changes
-------

Bareos 16.2 did major changes to the way Bareos treats configuration file.
However, when updating from bareos < 16.2, most of these changes are activated, as the legacy configuration will still be used.

    * configsubdirectories
        * if legacy config file ($BAREOS_CONFIG_DIR/$COMPONENT.conf) not found, following wildcard path will be used to load the configuration:
            * $BAREOS_CONFIG_DIR/$COMPONENT.d/*/*.conf
        * one config file per resource. Name of the config file is identical with the resource name.
            * e.g.
                * bareos-dir.d/director/bareos-dir.conf
                * bareos-dir.d/pool/Full.conf
            * There is one exception: the resource bareos-fd.d/client/myself.conf always has the file name myself.conf, while the name is normally set to the hostname of the system.
        * the -c command line switch takes file and directories as arguments. When the argument is a directory, $COMPONENT.d/*/*.conf is added to load the configuration.
    * package may contain configuration files for other packages.
        * Deprecated with Bareos 25, as these files are not guaranteed to be copied from the defaultconfigs directory to the live config directory.
        * However, most additional configuration resources require configuration. These configuration come as example files:
            * $BAREOS_CONFIG_DIR/$COMPONENT.d/$RESOURCE/$NAME.conf.example
            * For example, the bareos-webui comes with two config resources for the bareos-director:
                * $BAREOS_CONFIG_DIR/bareos-director.d/profile/webui.conf
                * $BAREOS_CONFIG_DIR/bareos-director.d/console/user1.conf.example
    * modified resource names:
        * $HOSTNAME-dir => bareos-dir
        * $HOSTNAME-sd => bareos-sd
            * make more sense when installing just the fd. Then probably only the Address must be changed.
            * fits better into configsubdirectory structure and packaging,
                because otherwise the filename is only known at install time /and might change)
        * "Linux All" => "LinuxAll"
            * Spaces are still valid in resource names. However, the build configuration script wasn't able to cope the file names containing spaces.
    * bareos-traymonitor
        * also single file per resource.
        * bareos-traymonitor package only contains $BAREOS_CONFIG_DIR/tray-monitor.d/monitor/bareos-mon.conf.
            * The other resources are part of the related packages:
                * $BAREOS_CONFIG_DIR/tray-monitor.d/client/FileDaemon-local.conf is part of bareos-filedaemon
                * $BAREOS_CONFIG_DIR/tray-monitor.d/storage/StorageDaemon-local.conf is part of bareos-storage
                * $BAREOS_CONFIG_DIR/tray-monitor.d/director/Director-local.conf is part of bareos-director
            * This way, the bareos-traymonitor will be configured automatically for the installed components.

How to use configsubdirectories
-------------------------------

    * Fresh installation
        * We easiest way to start with configsubdirectories and configuration API is to start with a fresh installation.
        * The package post-installation script copies over the files
          from the $BAREOS_CONFIG_TEMPLATE_DIR to the $BAREOS_CONFIG_DIR.
          Necessary adjustments are done there (set hostname and random passwords).
        * Notice:
          * Bareos sub-packages may add additional files to the $BAREOS_CONFIG_TEMPLATE_DIR, mostly *.example files.
          When this happens after the initial installation,
          these files are only present in the $BAREOS_CONFIG_TEMPLATE_DIR.
          If required, they must be copied manually.

    * Update
        * When update to a Bareos version containing configsubdirectories (Bareos >= 16.2), the existing configuration will not be touched and is still the default configuration.
        * Attention: Problems can occur, if you have already split your configuration to the same subdirectories as used by the new packages ($BAREOS_CONFIG_DIR/$COMPONENT.d/*/) and have implemented an own wildcard mechanism to load them. In this case, newly installed configuration resource files can alter your current configuration in adding additional resources.
        * As long as the old configuration file ($BAREOS_CONFIG_DIR/$COMPONENT.conf) exists, it will be used.
        * The correct way to migrate to the new configuration scheme would be to split the configuration file into resources, store them in the resource directories and then remove the original configuration file.
