Integrate Coolify API client and module for managing Coolify services, enhancing automation and deployment processes.
This commit is contained in:
@@ -8,6 +8,7 @@ ini_set('zlib.output_compression', false);
|
||||
*/
|
||||
const WD = __DIR__;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once 'config.php';
|
||||
|
||||
/** CORS */
|
||||
@@ -16,7 +17,7 @@ $allowed_origins = array_map('trim', explode(',', (string)($CORS ?? '*')));
|
||||
if ($CORS === '*' || ($origin && in_array($origin, $allowed_origins))) {
|
||||
header("Access-Control-Allow-Origin: " . ($origin ?: '*'));
|
||||
header("Access-Control-Allow-Credentials: true");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Customer-Number, *");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Customer-Number, X-Release-Trace, X-Release-Channel, X-Frontend-Version, *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS");
|
||||
}
|
||||
|
||||
@@ -26,7 +27,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
||||
header("Access-Control-Allow-Origin: " . ($origin ?: '*'));
|
||||
header("Access-Control-Allow-Credentials: true");
|
||||
header('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: *');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Customer-Number, X-Release-Trace, X-Release-Channel, X-Frontend-Version, *');
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(200);
|
||||
exit;
|
||||
@@ -169,6 +170,8 @@ spl_autoload_register(function (string $class): void {
|
||||
|
||||
use classes\application_write_freeze;
|
||||
use classes\db;
|
||||
use classes\replication_manager;
|
||||
use classes\release_manager;
|
||||
use classes\redis;
|
||||
use classes\request;
|
||||
use classes\response;
|
||||
@@ -196,6 +199,24 @@ try {
|
||||
$response->error($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
try {
|
||||
release_manager::initializeRequestContext();
|
||||
} catch (Throwable $e) {
|
||||
error_log('[release-manager] Could not initialize request context: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
$replicationBootstrapSnapshotForRequest = replication_bootstrap_config::loadSnapshot();
|
||||
$pendingStartupFailovers = is_array($replicationBootstrapSnapshotForRequest['pending_failovers'] ?? null)
|
||||
? $replicationBootstrapSnapshotForRequest['pending_failovers']
|
||||
: [];
|
||||
if ($pendingStartupFailovers !== []) {
|
||||
(new replication_manager())->syncStartupFailoversFromSnapshot();
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
error_log('[replication-bootstrap] Could not sync startup failover metadata: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if (application_write_freeze::shouldBlock(
|
||||
$_SERVER['REQUEST_METHOD'] ?? 'GET',
|
||||
$_SERVER['REQUEST_URI'] ?? '/',
|
||||
|
||||
Reference in New Issue
Block a user