Skip to content

Commit

Permalink
Add database status to /api/info
Browse files Browse the repository at this point in the history
  • Loading branch information
fracz committed Dec 28, 2021
1 parent 974e40c commit 68e8c9e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/controllers/SystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use suplascripts\app\Application;
use suplascripts\app\authorization\JwtAndBasicAuthorizationMiddleware;
use suplascripts\models\User;

class SystemController extends BaseController {
public function getInfoAction() {
Expand All @@ -17,6 +18,7 @@ public function getInfoAction() {
'scriptsUrl' => $this->getApp()->getSetting('oauth')['scriptsUrl'] ?? 'https://supla.fracz.com',
'cloudUrl' => $this->getApp()->getSetting('oauth')['cloudUrl'] ?? 'https://cloud.supla.org',
'time' => (new \DateTime())->format(\DateTime::ATOM),
'databaseStatus' => User::count() > 0 ? 'database ok' : 'database down',
];
if ($authenticated) {
$response['user'] = ['username' => $this->getCurrentUser()->username];
Expand Down

0 comments on commit 68e8c9e

Please sign in to comment.