Manage shared ARNavi VPS contours and application keys from infrastructure
This commit is contained in:
@@ -81,6 +81,7 @@ export function createControlCoreApp({
|
||||
gatewayIngest = null,
|
||||
edgeChannelStatusProvider = null,
|
||||
typedCommandRuntime = null,
|
||||
b2Infrastructure = null,
|
||||
} = {}) {
|
||||
if (!repository || typeof repository.health !== "function") {
|
||||
throw new TypeError("device_repository_required");
|
||||
@@ -204,6 +205,17 @@ export function createControlCoreApp({
|
||||
});
|
||||
}
|
||||
|
||||
if (request.method === "POST" && requestUrl.pathname === "/internal/v1/b2/infrastructure") {
|
||||
if (!managementApiEnabled || !b2Infrastructure) return writeJson(response, 503, { ok: false, error: "b2_infrastructure_unavailable" });
|
||||
if (!matchesBearer(request.headers.authorization, managementToken)) return writeJson(response, 401, { ok: false, error: "device_management_auth_required" });
|
||||
const requestId = String(request.headers["idempotency-key"] || "");
|
||||
if (!/^[a-f0-9]{32}$/.test(requestId)) throw new TypeError("b2_request_id_invalid");
|
||||
const actor = managementActorFromHeaders(request.headers);
|
||||
const input = await readJsonBody(request, 64 * 1024);
|
||||
const result = await b2Infrastructure.execute(actor, input, requestId);
|
||||
return writeJson(response, 200, { ok: true, result });
|
||||
}
|
||||
|
||||
const managementCommandKind = managementRoutes.get(requestUrl.pathname);
|
||||
if (request.method === "POST" && managementCommandKind) {
|
||||
if (!managementApiEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user