Skip to main content

Module vps

Module vps 

Source
Expand description

VPS record CRUD and persistence (XDG + atomic TOML + flock).

No .env at runtime. Schema v3 English wire (dual-read PT legacy).

Re-exports§

pub use selection::dedupe_host_names;
pub use selection::resolve_host_jobs;
pub use selection::HostSelection;

Modules§

model
Data model for VpsRecord (schema v3) — domain newtypes (G-TYPE-*).
selection
Multi-host selection resolution (SRP extract — G-COMP-01). Multi-host selection resolution for bounded fan-out (G-PAR-27 / G-PAR-31).

Structs§

ConfigFile
Full configuration file.
ConfigLayer
Winning configuration layer (doctor).
ExecOptions
Common remote execution options.
HostExecResult
Per-host result for multi-host exec JSON/text.
HostHealthResult
Per-host health-check outcome for batch output.

Constants§

MAX_SECRET_STDIN_BYTES
Hard cap for secret payloads on stdin (agent hardening / DoS guard).

Functions§

build_connection_config
Builds ConnectionConfig from a VpsRecord.
default_config_path
Returns the config file path under XDG (--config-dir wins at call sites).
find_by_name
Looks up a VPS record by name.
load
Loads the configuration file (returns empty if missing).
parse_import_payload
Parses import source: TOML wire or JSON vps-export envelope / hosts map. Parse import payload (TOML or JSON envelope). Public for fuzz targets (G-SERDE-12).
read_active_vps
Reads the active VPS name.
read_secret_stdin
Reads a password line from stdin (no extra echo).
resolve_config_path
Resolves the config file path from an optional override.
run_connect
Sets the active VPS by writing its name to <config_dir>/active (sibling file).
run_exec
Runs a shell command on one VPS or a multi-host selection (bounded).
run_exec_with_client
Testable version of run_exec.
run_health_check
Health-check SSH (single host or multi-host bounded fan-out).
run_secrets_command
Dispatcher one-shot de secrets status|init|reencrypt. Secrets primary-key status/init/reencrypt.
run_su_exec
Runs a command via su - one-shot (consumes su_password).
run_sudo_exec
Runs a command with sudo (packed via sh -c).
run_sudo_exec_with_client
Testable version of sudo-exec.
run_vps_command
Dispatcher dos subcomandos vps.
save
Saves the configuration file atomically with flock and 0o600.
use_json
JSON efetivo a partir de flag local e format global (IO-001/002).
winning_layer
Resolves and describes the winning config layer.
write_atomic
Writes bytes to path atomically (tempfile + fsync + rename + 0o600).