![]() |
![]()
| ![]() |
![]()
CLASS METHODSget_default_pathDetermine 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:
load_profilesLoads 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. CONSTRUCTORSload_configA 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. parseConstruct 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 <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md>. 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:
METHODScheck_dbReturns a normalized string based on the supported databases. EXCEPTION Dies if the value is not one of SQLite, PostgreSQL or MySQL. DB_engineGet the value of DB.engine <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#engine>. Returns one of "SQLite", "PostgreSQL" or "MySQL". DB_polling_intervalGet the value of DB.polling_interval <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#polling_interval>. Returns a number. MYSQL_databaseGet the value of MYSQL.database <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#database>. Returns a string. MYSQL_hostGet the value of MYSQL.host <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#host>. Returns a string. MYSQL_portReturns the MYSQL.port <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#port> property from the loaded config. Returns a number. MYSQL_passwordGet the value of MYSQL.password <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#password>. Returns a string. MYSQL_userGet the value of MYSQL.user <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#user>. Returns a string. POSTGRESQL_databaseGet the value of POSTGRESQL.database <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#database-1>. Returns a string. POSTGRESQL_hostGet the value of POSTGRESQL.host <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#host-1>. Returns a string. POSTGRESQL_portReturns the POSTGRESQL.port <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#port-1> property from the loaded config. Returns a number. POSTGRESQL_passwordGet the value of POSTGRESQL.password <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#password-1>. Returns a string. POSTGRESQL_userGet the value of POSTGRESQL.user <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#user-1>. Returns a string. SQLITE_database_fileGet the value of SQLITE.database_file <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#database_file>. Returns a string. LANGUAGE_localeGet the value of LANGUAGE.locale <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#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", ) PUBLIC_PROFILESGet the set of PUBLIC PROFILES <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#public-profiles-and-private-profiles-sections>. 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. PRIVATE_PROFILESGet the set of PRIVATE PROFILES <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#public-profiles-and-private-profiles-sections>. 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). ZONEMASTER_max_zonemaster_execution_timeGet the value of ZONEMASTER.max_zonemaster_execution_time <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#max_zonemaster_execution_time>. Returns a number. ZONEMASTER_number_of_processes_for_frontend_testingGet the value of ZONEMASTER.number_of_processes_for_frontend_testing <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#number_of_processes_for_frontend_testing>. Returns a number. ZONEMASTER_number_of_processes_for_batch_testingGet the value of ZONEMASTER.number_of_processes_for_batch_testing <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#number_of_processes_for_batch_testing>. Returns a number. ZONEMASTER_lock_on_queueGet the value of ZONEMASTER.lock_on_queue <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#lock_on_queue>. Returns a number. ZONEMASTER_age_reuse_previous_testGet the value of ZONEMASTER.age_reuse_previous_test <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#age_reuse_previous_test>. Returns a number. METRICS_statsd_hostGet the value of METRICS.statsd_host <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#statsd_host>. Returns a string. METRICS_statsd_portGet the value of METRICS.statsd_host <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#statsd_port>. Returns a number. RPCAPI_enable_user_createExperimental. Get the value of RPCAPI.enable_user_create <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#enable_user_create>. Return 0 or 1 RPCAPI_enable_batch_createExperimental. Get the value of RPCAPI.enable_batch_create <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#enable_batch_create>. Return 0 or 1 RPCAPI_enable_add_api_userGet the value of RPCAPI.enable_add_api_user <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#enable_add_api_user>. Return 0 or 1 RPCAPI_enable_add_batch_jobGet the value of RPCAPI.enable_add_batch_job <https://github.com/zonemaster/zonemaster/blob/master/docs/public/configuration/backend.md#enable_add_batch_job>. Return 0 or 1 new_DBCreate a new database adapter object according to configuration. The adapter connects to the database before it is returned. INPUT 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. RETURNS A configured Zonemaster::Backend::DB object. EXCEPTIONS new_PMCreate a new processing manager object according to configuration. INPUT The values of the following attributes affect the construction of the returned object:
RETURNS A configured Parallel::ForkManager object.
|