Refactoring and adding new specs
This commit is contained in:
parent
78fb874886
commit
7102b14e8b
|
@ -507,21 +507,11 @@ async_recovery 1
|
|||
# Required for some features like the module graphs macros.
|
||||
|
||||
# console_api_url: Api URL (http://localhost/pandora_console/include/api.php by default)
|
||||
console_api_url http://localhost/pandora_console/include/api.php
|
||||
# console_api_url http://localhost/pandora_console/include/api.php
|
||||
|
||||
# console_api_pass: Api pass
|
||||
# console_api_pass 1234
|
||||
|
||||
# console_user: Console user name (admin by default)
|
||||
console_user admin
|
||||
|
||||
# console_pass: Console password (pandora by default)
|
||||
# To make sure console_api_url, console_api_pass, console_user and console_pass are properly configured run:
|
||||
# curl "<console_api_url>?op=get&op2=test&apipass=<console_api_pass>&user=<console_user>&pass=<console_pass>"
|
||||
# It should return a string similar to:
|
||||
# OK,{VERSION},{BUILD}
|
||||
console_pass pandora
|
||||
|
||||
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
|
||||
#encryption_passphrase passphrase
|
||||
|
||||
|
|
|
@ -577,21 +577,11 @@ sub main() {
|
|||
pandora_event (\%Config, "Warmup mode for events started.", 0, 0, 0, 0, 0, 'system', 0, $DBH);
|
||||
}
|
||||
|
||||
# Console Api pass (if not defined)
|
||||
if ( !defined($Config{"console_api_pass"}) ) {
|
||||
$Config{"console_api_pass"} = pandora_get_tconfig_token ($DBH, 'api_password', '');
|
||||
|
||||
if ( $Config{"console_api_pass"} eq '' ) {
|
||||
$Config{"console_api_pass"} = '1234';
|
||||
db_process_update ($DBH, 'tconfig', {'value' => $Config{"console_api_pass"}}, {'token' => 'api_password'});
|
||||
}
|
||||
}
|
||||
|
||||
# Only if console_api_url has not defined
|
||||
# Only if console_api_url was not defined
|
||||
if( !defined($Config{"console_api_url"}) ) {
|
||||
my $console_api_url = pandora_get_tconfig_token ($DBH, 'public_url', '');
|
||||
|
||||
# If console_api_url is empty in database
|
||||
# If public_url is empty in database
|
||||
if ( $console_api_url eq '' ) {
|
||||
$console_api_url = 'http://localhost/pandora_console/';
|
||||
logger(\%Config, "Assuming default path for API url: " . $console_api_url, 3);
|
||||
|
@ -600,11 +590,25 @@ sub main() {
|
|||
$Config{"console_api_url"} = $console_api_url . 'include/api.php';
|
||||
}
|
||||
|
||||
# Only if console_api_pass was not defined
|
||||
if ( !defined($Config{"console_api_pass"}) ) {
|
||||
my $console_api_pass = pandora_get_tconfig_token ($DBH, 'api_password', '');
|
||||
|
||||
# If api_password is empty in database
|
||||
if ( $console_api_pass eq '' ) {
|
||||
$console_api_pass = '1234';
|
||||
db_process_update ($DBH, 'tconfig', {'value' => $console_api_pass}, {'token' => 'api_password'});
|
||||
}
|
||||
|
||||
$Config{"console_api_pass"} = $console_api_pass;
|
||||
}
|
||||
|
||||
# Definition of configuration file
|
||||
my $cfg_file = $Config{'pandora_path'};
|
||||
|
||||
# Randomized parametrization of console_pass. Must be done here.
|
||||
# Only if console_pass was not defined.
|
||||
if ( !defined($Config{"console_pass"}) ){
|
||||
# Randomized parametrization of console_pass.
|
||||
if (open (CFG, ">>$cfg_file")) {
|
||||
my $valid_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
my $num_char = 8;
|
||||
|
@ -627,7 +631,7 @@ sub main() {
|
|||
}
|
||||
}
|
||||
|
||||
# Only if console_user is not defined
|
||||
# Only if console_user was not defined
|
||||
if ( !defined($Config{"console_user"}) ) {
|
||||
my $pandora_uid = pandora_get_tconfig_token ($DBH, 'pandora_uid', '');
|
||||
|
||||
|
|
|
@ -560,6 +560,9 @@ async_recovery 1
|
|||
# console_api_url: Api URL (http://localhost/pandora_console/include/api.php by default)
|
||||
# console_api_url http://localhost/pandora_console/include/api.php
|
||||
|
||||
# console_api_pass: Api pass
|
||||
# console_api_pass 1234
|
||||
|
||||
# Passphrase used to generate the key for password encryption (PANDORA FMS ENTERPRISE ONLY).
|
||||
#encryption_passphrase passphrase
|
||||
|
||||
|
|
Loading…
Reference in New Issue