Add the Bird Control Plane gateway, signed webhook ingestion, policy-gated writes, fail-closed production auto-activation, and RSA-OAEP bootstrap credential flow.
33 lines
996 B
PHP
Executable File
33 lines
996 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
if (PHP_SAPI !== 'cli') {
|
|
fwrite(STDERR, "This command is CLI-only.\n");
|
|
exit(2);
|
|
}
|
|
|
|
const WD = __DIR__ . '/../services/nginx/app';
|
|
require_once WD . '/vendor/autoload.php';
|
|
require_once WD . '/config.php';
|
|
require_once WD . '/classes/db.php';
|
|
require_once WD . '/modules/bird/classes/bird_control_plane_schema_bootstrap.php';
|
|
|
|
$command = $argv[1] ?? 'check';
|
|
if (!in_array($command, ['check', 'apply'], true)) {
|
|
fwrite(STDERR, "Usage: scripts/bird-control-plane-schema.php check|apply --yes\n");
|
|
exit(2);
|
|
}
|
|
|
|
$pdo = \classes\db::getPDO();
|
|
if ($command === 'apply') {
|
|
if (($argv[2] ?? '') !== '--yes') {
|
|
fwrite(STDERR, "Refusing schema mutation without: apply --yes\n");
|
|
exit(2);
|
|
}
|
|
\bird\classes\bird_control_plane_schema_bootstrap::apply($pdo);
|
|
}
|
|
|
|
$status = \bird\classes\bird_control_plane_schema_bootstrap::check($pdo);
|
|
fwrite(STDOUT, json_encode($status, JSON_UNESCAPED_SLASHES) . PHP_EOL);
|
|
exit($status['ready'] ? 0 : 1);
|