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:
dingo
2026-09-29 14:12:26 -04:00
co-authored by Claude Opus 5.5
parent 2d950060db
commit 8d594f28af
12 changed files with 221 additions and 31 deletions
+9
View File
@@ -7,6 +7,7 @@
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <vector>
namespace evo::persistence {
@@ -19,6 +20,14 @@ struct PgOptions {
std::string host, hostaddr, port, database, user, password_file, ca_file;
};
using PgRows = std::vector<std::vector<std::optional<std::string>>>;
// Reads one section of a libpq connection service file (M8.3): host, hostaddr,
// port, dbname, user and sslrootcert (as ca_file). sslmode may only be verify-full
// (or disable for a local socket), and connect_timeout is accepted and ignored (the
// adapter has its own deadlines). Anything else (password, passfile, options, a
// missing or repeated section, a repeated key, a file over 4 KiB) is refused with
// config. password_file stays empty: the caller supplies it.
[[nodiscard]] std::expected<PgOptions, PgError> read_pg_service(const std::string& file,
std::string_view section);
// Linux I/O-owner adapter. Query text is trusted application SQL, values are parameters.
// No automatic retry. unknown means the command may have executed; connection is closed.
class Postgres {