Skip to content

Commit 37f9931

Browse files
committed
Modernize.
1 parent 01105c8 commit 37f9931

14 files changed

+26
-435
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ systemctl enable php8.3-fpm
6262
systemctl enable nginx
6363
systemctl start postgresql
6464
systemctl enable postgresql
65+
systemctl restart postgresql
6566
systemctl start mysql
6667
systemctl enable mysql
6768
```

glued/Config/routes.yaml

-211
This file was deleted.

glued/Controllers/AbstractController.php

-42
This file was deleted.

glued/Controllers/AuthController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace Glued\Controllers;
44

55
use Glued\Lib\QuerySelect;
6-
use mysql_xdevapi\Exception;
76
use Psr\Http\Message\ResponseInterface as Response;
87
use Psr\Http\Message\ServerRequestInterface as Request;
8+
use Glued\Lib\Controllers\AbstractBlank;
99

10-
class AuthController extends AbstractController
10+
class AuthController extends AbstractBlank
1111
{
1212

1313
/**

glued/Controllers/ConfigController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
use Psr\Http\Message\ResponseInterface as Response;
88
use Psr\Http\Message\ServerRequestInterface as Request;
9+
use Glued\Lib\Controllers\AbstractBlank;
910

10-
11-
class ConfigController extends AbstractController
11+
class ConfigController extends AbstractBlank
1212
{
1313

1414
/**

glued/Controllers/FeController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
use Psr\Http\Message\ResponseInterface as Response;
88
use Psr\Http\Message\ServerRequestInterface as Request;
9+
use Glued\Lib\Controllers\AbstractBlank;
910

10-
class FeController extends AbstractController
11+
class FeController extends AbstractBlank
1112
{
1213

1314
//

glued/Controllers/ServiceController.php

+2-35
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,14 @@
44

55
namespace Glued\Controllers;
66

7-
use mysql_xdevapi\Exception;
7+
use Glued\Lib\Controllers\AbstractService;
88
use Psr\Http\Message\ResponseInterface as Response;
99
use Psr\Http\Message\ServerRequestInterface as Request;
1010
use Glued\Lib\Exceptions\TransformException;
1111

12-
class ServiceController extends AbstractController
12+
class ServiceController extends AbstractService
1313
{
1414

15-
public function getOpenapi(Request $request, Response $response, array $args = []): Response
16-
{
17-
// Directory to look for paths
18-
$path = "{$this->settings['glued']['datapath']}/{$this->settings['glued']['uservice']}/cache" ;
19-
$filesWhitelist = ["openapi.json", "openapi.yaml", "openapi.yml"]; // Potential file names
20-
21-
foreach ($filesWhitelist as $file) {
22-
$fullPath = rtrim($path, '/') . '/' . $file;
23-
if (file_exists($fullPath)) {
24-
$content = file_get_contents($fullPath);
25-
$response->getBody()->write($content);
26-
$contentType = 'application/json';
27-
if (pathinfo($fullPath, PATHINFO_EXTENSION) === 'yaml' || pathinfo($fullPath, PATHINFO_EXTENSION) === 'yml') { $contentType = 'application/x-yaml'; }
28-
return $response->withHeader('Content-Type', $contentType);
29-
}
30-
}
31-
throw new \Exception("OpenAPI specification not found", 404);
32-
}
33-
34-
public function getHealth(Request $request, Response $response, array $args = []): Response {
35-
try {
36-
$check['service'] = basename(__ROOT__);
37-
$check['timestamp'] = microtime();
38-
$check['healthy'] = true;
39-
$check['status']['postgres'] = $this->pg->query("select true as test")->fetch()['test'] ?? false;
40-
$check['status']['auth'] = $_SERVER['X-GLUED-AUTH-UUID'] ?? 'anonymous';
41-
} catch (Exception $e) {
42-
$check['healthy'] = false;
43-
return $response->withJson($check);
44-
}
45-
return $response->withJson($check);
46-
}
47-
4815
/**
4916
* Returns list of routes.
5017
* @param Request $request

glued/Controllers/StatusController.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44

55
namespace Glued\Controllers;
66

7+
use Glued\Lib\Controllers\AbstractBlank;
78
use Psr\Http\Message\ResponseInterface as Response;
89
use Psr\Http\Message\ServerRequestInterface as Request;
910
use Glued\Classes\Auth;
10-
use Glued\Lib\Exceptions\DefaultException;
11-
use Glued\Lib\Exceptions\AuthTokenException;
12-
use Glued\Lib\Exceptions\AuthJwtException;
13-
use Glued\Lib\Exceptions\AuthOidcException;
14-
use Glued\Lib\Exceptions\DbException;
1511
use Glued\Lib\Exceptions\TransformException;
1612
use Linfo\Linfo;
1713

1814

19-
class StatusController extends AbstractController
15+
class StatusController extends AbstractBlank
2016
{
2117

2218
/**

0 commit comments

Comments
 (0)