Skip to content
Snippets Groups Projects
Commit 0e71cd53 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update cert check validation

parent b17c2048
No related branches found
No related tags found
1 merge request!6update cert check validation
...@@ -57,7 +57,7 @@ class checkCert extends appmonitorcheck ...@@ -57,7 +57,7 @@ class checkCert extends appmonitorcheck
'url' => [ 'url' => [
'type' => 'string', 'type' => 'string',
'required' => true, 'required' => true,
'description' => 'Url to check https://[server}[:{port}] or ssl://[server}[:{port}]', 'description' => 'Url to check https://[server}[:{port}] or ssl://[server}[:{port}]; autodetected on webserver with php but required on cli',
'default' => null, 'default' => null,
'regex'=>'/^(https|ssl):\/\/[^\s]+/', 'regex'=>'/^(https|ssl):\/\/[^\s]+/',
'example' => '', 'example' => '',
...@@ -86,6 +86,18 @@ class checkCert extends appmonitorcheck ...@@ -86,6 +86,18 @@ class checkCert extends appmonitorcheck
], ],
]; ];
/**
* Override explain()
* If https is used, url is not required because it can be autodetected from $_SERVER
*/
public function explain(): array
{
if($_SERVER['HTTPS']??false && $_SERVER['SERVER_NAME']??false){
$this->_aDoc['parameters']['url']['required']=false;
}
return $this->_aDoc;
}
/** /**
* Get default group of this check * Get default group of this check
* @return string * @return string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment