Determine the path for the default backend_config.ini file. A list of values and locations are checked and the first match is returned. If all places are checked and no file is found, an exception is thrown.
This procedure is idempotent - i.e. if you call this procedure multiple times the same value is returned no matter if environment variables or the file system have changed.
The following checks are made in order:
If this environment variable is set ot a truthy value, that path is returned.
If a file exists at this path, it is returned.
If a file exists at such a path, it is returned.
If a file exists at this path, it is returned. DIST_DIR is wherever File::ShareDir installs the Zonemaster-Backend dist.
Loads and returns a set of named profiles.
my %all_profiles = ( $config->PUBLIC_PROFILES, $config->PRIVATE_PROFILES, ); my %profiles = %{ Zonemaster::Backend::Config->load_profiles( %all_profiles ) };
Takes a hash mapping profile names to profile paths. An `undef` path value means the default profile.
Returns a hashref mapping profile names to profile objects.
The returned profiles have omitted values filled in with defaults from the default profile.
Dies if any of the given paths cannot be read or their contents cannot be parsed as JSON.
A wrapper around parse that also determines where the config file is located in the file system and reads it.
Throws an exception if the determined configuration file cannot be read. See parse for details on additional parsing-related error modes.
Construct a new Zonemaster::Backend::Config based on a given configuration.
my $config = Zonemaster::Backend::Config->parse( q{ [DB] engine = SQLite [SQLITE] database_file = /var/db/zonemaster.sqlite } );
The configuration is interpreted according to the configuration format specification.
Returns a new Zonemaster::Backend::Config instance with its properties set to normalized and untainted values according to the given configuration with defaults according to the configuration format.
Emits a log warning with a deprecation message for each deprecated property that is present.
Throws an exception if the given configuration contains errors.
In a valid config file:
all required properties are present, and
all sections and properties are recognized.
Returns a normalized string based on the supported databases.
Dies if the value is not one of SQLite, PostgreSQL or MySQL.
Get the value of DB.engine.
Returns one of "SQLite", "PostgreSQL" or "MySQL".
"SQLite"
"PostgreSQL"
"MySQL"
Get the value of DB.polling_interval.
Returns a number.
Get the value of MYSQL.database.
Returns a string.
Get the value of MYSQL.host.
Returns the MYSQL.port property from the loaded config.
Get the value of MYSQL.password.
Get the value of MYSQL.user.
Get the value of POSTGRESQL.database.
Get the value of POSTGRESQL.host.
Returns the POSTGRESQL.port property from the loaded config.
Get the value of POSTGRESQL.password.
Get the value of POSTGRESQL.user.
Get the value of SQLITE.database_file.
Get the value of LANGUAGE.locale.
Returns a mapping from two-letter locale tag prefixes to full locale tags. This is represented by a hash mapping prefix to full locale tag.
E.g.:
( en => "en_US", sv => "sv_SE", )
Get the set of PUBLIC PROFILES.
Returns a hash mapping profile names to profile paths. The profile names are normalized to lowercase. Profile paths are either strings or undef. undef means that the Zonemaster Engine default profile should be used.
undef
Get the set of PRIVATE PROFILES.
Returns a hash mapping profile names to profile paths. The profile names are normalized to lowercase. Profile paths are always strings (contrast with PUBLIC_PROFILES).
Get the value of ZONEMASTER.max_zonemaster_execution_time.
Get the value of ZONEMASTER.number_of_processes_for_frontend_testing.
Get the value of ZONEMASTER.number_of_processes_for_batch_testing.
Get the value of ZONEMASTER.lock_on_queue.
Get the value of ZONEMASTER.age_reuse_previous_test.
Get the value of METRICS.statsd_host.
Experimental. Get the value of RPCAPI.enable_user_create.
Return 0 or 1
Experimental. Get the value of RPCAPI.enable_batch_create.
Get the value of RPCAPI.enable_add_api_user.
Get the value of RPCAPI.enable_add_batch_job.
Create a new database adapter object according to configuration.
The adapter connects to the database before it is returned.
The database adapter class is selected based on the return value of DB_engine. The database adapter class constructor is called without arguments and is expected to configure itself according to available global configuration.
A configured Zonemaster::Backend::DB object.
Create a new processing manager object according to configuration.
The values of the following attributes affect the construction of the returned object:
A configured Parallel::ForkManager object.
To install Zonemaster::Backend, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zonemaster::Backend
CPAN shell
perl -MCPAN -e shell install Zonemaster::Backend
For more information on module installation, please visit the detailed CPAN module installation guide.