Skip to content
Snippets Groups Projects
Commit bbb8b0ae authored by jurgenhaas's avatar jurgenhaas
Browse files

Fix initial ping for new healthckecks

parent 80ba979b
No related branches found
No related tags found
1 merge request!21Merging develop into main
Pipeline #525151 passed
This commit is part of merge request !21. Comments created here will be created in the context of that merge request.
...@@ -519,14 +519,14 @@ class Handler extends BaseHandler { ...@@ -519,14 +519,14 @@ class Handler extends BaseHandler {
'dest' => $projectRoot . '/backup', 'dest' => $projectRoot . '/backup',
'condition' => $this->config->readValue(['backup', 'enable']), 'condition' => $this->config->readValue(['backup', 'enable']),
]; ];
$files['crontab.txt'] = [ $files['crontab.txt'] = [
'source' => 'backup/', 'source' => 'backup/',
'dest' => $projectRoot . '/backup', 'dest' => $projectRoot . '/backup',
'condition' => $this->config->readValue(['backup', 'enable']), 'condition' => $this->config->readValue(['backup', 'enable']),
]; ];
// Manage crontabs and optionally add them to heathcheck-io // Manage crontabs and optionally add them to heathcheck-io.
$hj_api_url = getenv('HEALTHCHECK_API_URL'); $hj_url = getenv('HEALTHCHECK_API_URL');
$hj_api_key = getenv('HEALTHCHECK_API_KEY'); $hj_api_key = getenv('HEALTHCHECK_API_KEY');
$hj_api_channels = getenv('HEALTHCHECK_API_CHANNELS'); $hj_api_channels = getenv('HEALTHCHECK_API_CHANNELS');
$hj_project = $this->config->readValue('projectname'); $hj_project = $this->config->readValue('projectname');
...@@ -535,8 +535,8 @@ class Handler extends BaseHandler { ...@@ -535,8 +535,8 @@ class Handler extends BaseHandler {
$hj_checks = []; $hj_checks = [];
$hj_manager = NULL; $hj_manager = NULL;
if (!empty($hj_api_url) && !empty($hj_api_key)) { if (!empty($hj_url) && !empty($hj_api_key)) {
$hj_manager = new HealthchecksManager($hj_api_key, $hj_api_url); $hj_manager = new HealthchecksManager($hj_api_key, $hj_url . '/api/v1/');
try { try {
$hj_checks = $hj_manager->listChecks(); $hj_checks = $hj_manager->listChecks();
} }
...@@ -575,14 +575,14 @@ class Handler extends BaseHandler { ...@@ -575,14 +575,14 @@ class Handler extends BaseHandler {
} }
if (!$check) { if (!$check) {
if ($disabled) { if ($disabled) {
// This task is disabled. As it doesn't exist yet, nothing to do. // This task is disabled as it doesn't exist yet, nothing to do.
continue; continue;
} }
try { try {
$check = $hj_manager->createCheck($task); $check = $hj_manager->createCheck($task);
$parts = explode('/', $check['ping_url']); $parts = explode('/', $check['ping_url']);
$uuid = array_pop($parts); $uuid = array_pop($parts);
$hj_check = new Healthchecks($uuid); $hj_check = new Healthchecks($uuid, $hj_url . '/ping/');
$hj_check->success(); $hj_check->success();
} }
catch (HealthchecksFailureException | HealthchecksUuidNotFoundException | HealthchecksAccountLimitReachedException | HealthchecksUnauthorisedException $e) { catch (HealthchecksFailureException | HealthchecksUuidNotFoundException | HealthchecksAccountLimitReachedException | HealthchecksUnauthorisedException $e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment