Add install --answers for an unattended install from a file #61

Merged
jcoffey-dev merged 1 commits from feat/install-answers into main 2026-11-13 15:42:20 +00:00
Owner

inbuxa install --answers FILE (roadmap [27.1] "Also add"): read the install options from a JSON file instead of a long command line, for an unattended install driven by cloud-init, Ansible or a kickstart.

  • The file's keys are the install flag names (domain, mail-host, console-host, webmail-host, email, proxy, dir, local, install-deps, acme-directory, acme-ca-root, server, console, webmail). A mistyped key is rejected, not silently ignored (DisallowUnknownFields).
  • A command-line flag always wins over the file, so one answers file can be a base a flag overrides. Implemented via fs.Visit to see which flags were actually set.
  • Carries no secrets -- the API key stays on --key/INBUXA_API_KEY -- and still needs --yes to carry the plan out, so a file alone changes nothing.

Shape: two small pure helpers in package main, parseAnswers (JSON, unknown-key-strict) and applyAnswers (fills only options not set on the command line), both unit-tested; the install command reads the file and calls them before building the plan. stdlib-only (uses encoding/json); no new deps. gofmt/vet (amd64+arm64)/go test ./... green. Smoke-tested: a --local answers file dry-runs to the right plan, an unknown key and a missing file each exit 2 with a clear message, --help lists it. README gets a bullet + an unattended example.

Distinct from plan/apply -f (a multi-machine topology file): this is the single-machine install's own flags in a file.

`inbuxa install --answers FILE` (roadmap [27.1] "Also add"): read the install options from a JSON file instead of a long command line, for an unattended install driven by cloud-init, Ansible or a kickstart. - The file's keys are the install flag names (`domain`, `mail-host`, `console-host`, `webmail-host`, `email`, `proxy`, `dir`, `local`, `install-deps`, `acme-directory`, `acme-ca-root`, `server`, `console`, `webmail`). A **mistyped key is rejected**, not silently ignored (`DisallowUnknownFields`). - **A command-line flag always wins over the file**, so one answers file can be a base a flag overrides. Implemented via `fs.Visit` to see which flags were actually set. - Carries **no secrets** -- the API key stays on `--key`/`INBUXA_API_KEY` -- and still needs `--yes` to carry the plan out, so a file alone changes nothing. Shape: two small pure helpers in package main, `parseAnswers` (JSON, unknown-key-strict) and `applyAnswers` (fills only options not set on the command line), both unit-tested; the install command reads the file and calls them before building the plan. stdlib-only (uses `encoding/json`); no new deps. gofmt/vet (amd64+arm64)/`go test ./...` green. Smoke-tested: a `--local` answers file dry-runs to the right plan, an unknown key and a missing file each exit 2 with a clear message, `--help` lists it. README gets a bullet + an unattended example. Distinct from `plan`/`apply -f` (a multi-machine topology file): this is the single-machine install's own flags in a file.
jcoffey-dev added 1 commit 2026-11-13 15:10:43 +00:00
jcoffey-dev merged commit e20f2ea96b into main 2026-11-13 15:42:20 +00:00
jcoffey-dev deleted branch feat/install-answers 2026-11-13 15:42:20 +00:00
Sign in to join this conversation.