UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

39 lines (38 loc) • 1.2 kB
//#region src/services/hosting/secrets.ts const RESERVED_SECRET_NAMES = /* @__PURE__ */ new Set([ "PORT", "API_DATABASE_URL", "AUTH_DATABASE_URL" ]); const RESERVED_SECRET_PREFIX = "BOS_"; const SECRET_NAME_PATTERN = /^[A-Z][A-Z0-9_]*$/; function isReservedSecretName(name) { return RESERVED_SECRET_NAMES.has(name) || name.startsWith("BOS_"); } function isValidSecretName(name) { return SECRET_NAME_PATTERN.test(name) && !isReservedSecretName(name); } /** The runtime identity a descriptor carries in its `identityEnv`. */ function descriptorRuntime(descriptor) { return { account: descriptor.identityEnv.BOS_ACCOUNT, gateway: descriptor.identityEnv.BOS_GATEWAY }; } /** * Merge resolved stored secrets into a descriptor's `identityEnv`. The * descriptor's own keys always win — stored values can never shadow the * platform-composed identity. */ function withSecrets(descriptor, stored) { return { ...descriptor, identityEnv: { ...stored, ...descriptor.identityEnv } }; } //#endregion export { RESERVED_SECRET_NAMES, RESERVED_SECRET_PREFIX, SECRET_NAME_PATTERN, descriptorRuntime, isReservedSecretName, isValidSecretName, withSecrets }; //# sourceMappingURL=secrets.mjs.map