assertSafeDataTarget (config/data-target.ts)

argos · apps/backend/src/config/data-target.ts · typescript · MIT
database, Database / ORM

TypeScript guard that validates safe data targets and prevents accidental production writes.

// Source: https://github.com/argos-ci/argos | License: MIT | Copyright 2017 Olivier Tassinari & Greg Bergé
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Guardrails around which data a process is allowed to touch.
 *
 * `ARGOS_TARGET=prod-ro` points a local process at the production database
 * through the read-only `argos_dev_ro` Postgres role (see CONTRIBUTING.md).
 * The Postgres grants are the hard write barrier; everything here is the
 * belt-and-braces layer that keeps the *rest* of the process from writing
 * anywhere production-shaped: jobs must land in local queues, and third-party
 * credentials that write elsewhere (emails, Stripe, git providers) must be
 * absent.
 */

const LOCAL_HOSTNAMES = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);

/**
 *

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key