get('/plugins/healthchecks/settings', function ($request, $response, $args) { /** * @OA\Get( * tags={"plugins-healthchecks"}, * path="/api/v2/plugins/healthchecks/settings", * summary="Get settings", * @OA\Response( * response="200", * description="Success", * @OA\JsonContent(ref="#/components/schemas/pluginSettingsPage"), * ), * @OA\Response(response="401",description="Unauthorized"), * security={{ "api_key":{} }} * ) */ $HealthChecks = new HealthChecks(); if ($HealthChecks->checkRoute($request)) { if ($HealthChecks->qualifyRequest(1, true)) { $GLOBALS['api']['response']['data'] = $HealthChecks->_healthCheckPluginGetSettings(); } } $response->getBody()->write(jsonE($GLOBALS['api'])); return $response ->withHeader('Content-Type', 'application/json;charset=UTF-8') ->withStatus($GLOBALS['responseCode']); }); $app->get('/plugins/healthchecks/run', function ($request, $response, $args) { /** * @OA\Get( * tags={"plugins-healthchecks"}, * path="/api/v2/plugins/healthchecks/run", * summary="Run Healthchecks.io plugin", * @OA\Response( * response="200", * description="Success", * @OA\JsonContent(ref="#/components/schemas/healthChecksRun"), * ), * @OA\Response(response="401",description="Unauthorized"), * security={{ "api_key":{} }} * ) */ $HealthChecks = new HealthChecks(); if ($HealthChecks->checkRoute($request)) { if ($HealthChecks->qualifyRequest($HealthChecks->config['HEALTHCHECKS-Auth-include'], true)) { $HealthChecks->_healthCheckPluginRun(); } } $response->getBody()->write(jsonE($GLOBALS['api'])); return $response ->withHeader('Content-Type', 'application/json;charset=UTF-8') ->withStatus($GLOBALS['responseCode']); });