Connect from libpq service files and match the real Secret layout
The maintainer's login Secrets carry pg_service.conf ([evolution]), pgpass and ca.crt. Add a strict read_pg_service (known keys only, verify-full unless a local socket, bounded size) behind --pg-service in evo-server and evo-world-clone, mount each login Secret whole in the store Jobs instead of reading aevolution-db, and fix the migrate Job's PGSERVICE to the [evolution] section. Record the store node choice, per-environment databases and the backup plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
// stats max_queued=<n> max_tick_debt=<n> commits=<n> store_failures=<n>
|
||||
// Exit: 0 drained, 2 usage, 3 drain deadline passed, 4 quarantined.
|
||||
//
|
||||
// --pg-service <file> (M8.3) takes host, hostaddr, port, database, user and CA from
|
||||
// the [evolution] section of a libpq service file; anything else in it is refused.
|
||||
//
|
||||
// --objects-reserve-mib <n> (M8.3, default 1024) refuses new objects that would leave
|
||||
// less free space on the object volume: node-local volumes do not enforce their
|
||||
// requested size. A refused upload is a store failure; nothing is acknowledged.
|
||||
@@ -129,7 +132,15 @@ std::optional<Options> parse(int argc, char** argv) {
|
||||
o.pg.user = value;
|
||||
else if (flag == "--pg-passfile")
|
||||
o.pg.password_file = value;
|
||||
else if (flag == "--pg-ca")
|
||||
else if (flag == "--pg-service") {
|
||||
// Connection from the [evolution] section of a libpq service file (M8.3);
|
||||
// the password file stays separate (--pg-passfile).
|
||||
auto service = persistence::read_pg_service(std::string(value), "evolution");
|
||||
if (!service)
|
||||
return std::nullopt;
|
||||
service->password_file = o.pg.password_file;
|
||||
o.pg = *service;
|
||||
} else if (flag == "--pg-ca")
|
||||
o.pg.ca_file = value;
|
||||
else if (flag == "--objects")
|
||||
o.objects = value;
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
// evo-world-clone check-store --world W --region R --pg-* ... --objects DIR
|
||||
// [--reserve-mib N]
|
||||
//
|
||||
// --*pg-* is host, hostaddr, port, database, user, passfile, ca. The source
|
||||
// --*pg-* is host, hostaddr, port, database, user, passfile, ca, or service (a libpq
|
||||
// service file whose [evolution] section supplies everything but the password file). The source
|
||||
// connection needs only the runtime read functions and is switched to read-only
|
||||
// transactions; the target connection is the target database's owner. Source and
|
||||
// target must be different databases reached with different users: a clone never
|
||||
@@ -103,6 +104,15 @@ bool pg_flag(std::string_view flag, std::string_view prefix, std::string_view va
|
||||
if (!flag.starts_with(prefix))
|
||||
return false;
|
||||
const auto name = flag.substr(prefix.size());
|
||||
if (name == "service") {
|
||||
// [evolution] section of a libpq service file; the password file stays separate.
|
||||
auto service = persistence::read_pg_service(std::string(value), "evolution");
|
||||
if (!service)
|
||||
return false;
|
||||
service->password_file = pg.password_file;
|
||||
pg = *service;
|
||||
return true;
|
||||
}
|
||||
std::string* field = name == "host" ? &pg.host
|
||||
: name == "hostaddr" ? &pg.hostaddr
|
||||
: name == "port" ? &pg.port
|
||||
|
||||
Reference in New Issue
Block a user