Skip to main content

apps/gateway/src/routes/settings.ts

Metadata

Indexed Symbols

  • validateSecretKey (line 26, function) - Implements validate secret key for HTTP request handling.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

import type { FastifyPluginAsync } from "fastify";
import {
putPlatformSettingsRequestSchema,
putWorkspaceSettingsRequestSchema,
upsertSecretRequestSchema
} from "@anchor/contracts";
import { getIdempotencyKey, getIdempotencyRouteScope } from "../utils/idempotency.js";
import { ensureRoles } from "../utils/authorization.js";
import { getWorkspaceIdFromHeaders } from "../utils/workspace.js";
import {
getEffectivePlatformSettings,
getEffectiveWorkspaceSettings,
invalidatePlatformSettingsCache
} from "../services/runtime-config.js";
import {
getPlatformSettingsRecord,
listRuntimeSecretKeys,
upsertPlatformSettingsRecord,
upsertRuntimeSecret,
upsertWorkspaceSettingsRecord
} from "../services/settings-repository.js";

const PLATFORM_SCOPE_WORKSPACE = "00000000-0000-0000-0000-000000000000";
const SECRET_KEY_REGEX = /^[A-Z0-9_]{3,64}$/;