Skip to main content

apps/gateway/src/routes/edge-agent.ts

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

import type { FastifyPluginAsync } from "fastify";
import { randomUUID } from "node:crypto";
import { SignJWT } from "jose";
import { getEffectiveWorkspaceSettings } from "../services/runtime-config.js";
import { query } from "../services/postgres.js";
import { getWorkspaceIdFromHeaders } from "../utils/workspace.js";
import { ensureRoles } from "../utils/authorization.js";
import { env } from "../config/env.js";
import { getIdempotencyKey, getIdempotencyRouteScope } from "../utils/idempotency.js";

const defaultPolicy = {
version: 1,
collection: {
heartbeat: { enabled: true, intervalSeconds: 60 },
patchCompliance: { enabled: true, intervalSeconds: 1800 },
backupStatus: { enabled: true, intervalSeconds: 900 }
},
remediation: {
autoApplyCriticalPatches: false,
requireApprovalForScripts: true
}
};

export const edgeAgentRoutes: FastifyPluginAsync = async (app) => {
app.get("/api/v1/edge-agent/policy", async (request, reply) => {