Documentation
¶
Overview ¶
Package spec parses and validates the DB_SPECS environment variable: a whitespace-separated list of "host[:port]:dbname:user" tuples describing which PostgreSQL databases to dump and over which network coordinates.
This is the single validation path. There is no second (shell) implementation to drift from, and the rules here are the only thing that stands between operator-supplied config and a pg_dump/psql argv. Passwords are never part of the grammar: libpq resolves them from .pgpass keyed on host:port:dbname:user.
Index ¶
Constants ¶
const DefaultPort = 5432
DefaultPort is the PostgreSQL port assumed when a spec omits one.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBSpec ¶
type DBSpec struct {
Host string
DBName string
User string
Raw string // original token, for error reporting and logs
Invalid string // non-empty => why this spec is invalid
Port int
}
DBSpec is one validated host[:port]:dbname:user tuple. A spec with a non-empty Invalid field failed validation and must never be passed to pg_dump; the orchestrator reports it per-DB and skips it.
func ParseSpecs ¶
ParseSpecs splits raw on whitespace and validates each tuple. Every token yields exactly one DBSpec (valid or Invalid); tokens are never dropped silently. Duplicate (host, port, dbname) keys keep the first occurrence and mark later ones Invalid. The returned slice preserves input order.