apps/gateway/src/services/runtime-config.ts
Metadata
- Purpose: Gateway service module implementing business logic or integrations.
- Domain:
applications - Language:
ts - Bytes: 4962
- Lines: 177
- Content hash (short):
81876604 - Source (start): apps/gateway/src/services/runtime-config.ts:1
- Source (end): apps/gateway/src/services/runtime-config.ts:177
Indexed Symbols
defaultPlatformSettings(line 15, function) - Implements default platform settings for service-layer operations.defaultWorkspaceSettings(line 51, function) - Implements default workspace settings for service-layer operations.mergePlatformSettings(line 69, function) - Implements merge platform settings for service-layer operations.getEffectivePlatformSettings(line 97, function) - Implements get effective platform settings for service-layer operations.getEffectiveWorkspaceSettings(line 118, function) - Implements get effective workspace settings for service-layer operations.invalidatePlatformSettingsCache(line 153, function) - Implements invalidate platform settings cache for service-layer operations.resolveSecretValue(line 157, function) - Implements resolve secret value for service-layer operations.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { platformSettingsSchema, workspaceSettingsSchema, type PlatformSettings, type WorkspaceSettings } from "@anchor/contracts";
import { env } from "../config/env.js";
import { getPlatformSettingsRecord, getRuntimeSecretValue, getWorkspaceSettingsRecord } from "./settings-repository.js";
const CACHE_TTL_MS = 10000;
type CachedPlatformSettings = {
expiresAt: number;
settings: PlatformSettings;
version: number;
};
const platformCache: { current: CachedPlatformSettings | null } = { current: null };
export function defaultPlatformSettings(): PlatformSettings {
return platformSettingsSchema.parse({
runtime: {
corsOrigins: env.corsOrigins,
requireWebhookSignatures: env.requireWebhookSignatures,
githubWebhookEnabled: env.githubWebhookEnabled,
trustProxy: env.trustProxy,
rateLimitEnabled: env.rateLimitEnabled,
rateLimitWindowMs: env.rateLimitWindowMs,
rateLimitRequestsPerWindow: env.rateLimitRequestsPerWindow
},