Skip to content

Commit c545eb7

Browse files
committed
add healthz endpoint
1 parent f3d1fd8 commit c545eb7

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/App.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ function () use ( $slim ) {
286286
$page->setBaseUrl( 'https://sge-jobs.toolforge.org' );
287287
$page( '/' );
288288
} )->name( 'oge-status' );
289+
290+
$slim->get( 'healthz', function () use ( $slim ) {
291+
$page = new Pages\Healthz();
292+
$page();
293+
} )->name( 'healthz' );
289294
}
290295
); // end group '/'
291296

src/Pages/Healthz.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* This file is part of Toolforge Admin
4+
* Copyright (C) 2016 Wikimedia Foundation and contributors
5+
*
6+
* This program is free software: you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License as published by the Free
8+
* Software Foundation, either version 3 of the License, or (at your option)
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14+
* more details.
15+
*
16+
* You should have received a copy of the GNU General Public License along
17+
* with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
namespace Tools\Admin\Pages;
21+
22+
use Wikimedia\Slimapp\Controller;
23+
24+
/**
25+
* Returns a 200 response.
26+
*/
27+
class Healthz extends Controller {
28+
protected function handleGet() {
29+
$this->contentType( 'text/plain' );
30+
echo "OK";
31+
}
32+
}

0 commit comments

Comments
 (0)