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:
@@ -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