NAME

Zonemaster::Backend::Config::DCPlugin - Daemon::Control plugin that loads the backend configuration.

SYNOPSIS

Provides validated and sanity-checked backend configuration through the config property.

my $daemon = Daemon::Control
    ->with_plugins('+Zonemaster::Backend::Config::DCPlugin')
    ->new({
        program => sub {
            my $self = shift;
            my $db   = $self->config->{db};
            ...
        },
    });

The configuration is loaded on start and restart. The start/restart is aborted if the configuration fails the validity- and sanity check. In case of the database configuration, sanity is checked by actually connecting to the database.

AUTHOR

Mattias P, <mattias.paivarinta@iis.se>

CLASS VARIABLES

%config

The loaded configuration.

PROPERTIES

config

The loaded configuration.

A hashref with the following keys.

db

A Zonemaster::Backned::DB object. It's been able to connect to the database at least once.

PRIVATE METHODS

_load_config

Checks if the configuration has been loaded before, and delegates to _load_config otherwise.

_do_load_config

Loads, validates and sanity-checks the backend configuration.