Read any secret from a _FILE variable #75

Merged
jcoffey-dev merged 1 commits from feat/migrate-secret-files into main 2026-11-12 23:22:49 +00:00
Owner

Every secret taken from an INBUXA_MIGRATE_* variable can instead be read from a file named by the same variable with _FILE appended — the Docker, Compose and systemd secrets convention (INBUXA_MIGRATE_PASSWORD_FILE, INBUXA_MIGRATE_API_KEY_FILE, INBUXA_MIGRATE_EWS_CLIENT_SECRET_FILE, and so on).

  • Consistent, zero new flags. The rule lives in the one place every secret already funnels through, secret::from_env, so it covers every source uniformly with no per-source clap flags. Precedence: flag value → $VAR → $VAR_FILE → prompt.
  • One trailing newline (LF or CRLF) is stripped; other whitespace is kept. An empty or unreadable file is a usage error. Setting both $VAR and $VAR_FILE is rejected.
  • The EWS client secret, previously read with a bare env::var, now goes through from_env too and gains the same support.
  • Keeps a secret out of both the environment and the command line (shell history, process list).

README Credentials + docs/usage.md + CHANGELOG updated. 5 new unit tests (file newline-strip, empty/missing errors, direct-vs-file precedence, both-set rejection); smoke-tested in the real binary (file read reaches the network; both-set and missing-file stop before connecting). fmt/clippy/cargo test --locked (1207 lib + integration) green.

Rolling-bucket item: migrate secrets-from-file.

Every secret taken from an `INBUXA_MIGRATE_*` variable can instead be read from a file named by the same variable with `_FILE` appended — the Docker, Compose and systemd secrets convention (`INBUXA_MIGRATE_PASSWORD_FILE`, `INBUXA_MIGRATE_API_KEY_FILE`, `INBUXA_MIGRATE_EWS_CLIENT_SECRET_FILE`, and so on). - **Consistent, zero new flags.** The rule lives in the one place every secret already funnels through, `secret::from_env`, so it covers every source uniformly with no per-source clap flags. Precedence: flag value → `$VAR` → `$VAR_FILE` → prompt. - One trailing newline (LF or CRLF) is stripped; other whitespace is kept. An empty or unreadable file is a usage error. Setting both `$VAR` and `$VAR_FILE` is rejected. - The EWS client secret, previously read with a bare `env::var`, now goes through `from_env` too and gains the same support. - Keeps a secret out of both the environment and the command line (shell history, process list). README Credentials + docs/usage.md + CHANGELOG updated. 5 new unit tests (file newline-strip, empty/missing errors, direct-vs-file precedence, both-set rejection); smoke-tested in the real binary (file read reaches the network; both-set and missing-file stop before connecting). fmt/clippy/`cargo test --locked` (1207 lib + integration) green. Rolling-bucket item: migrate secrets-from-file.
jcoffey-dev added 1 commit 2026-11-12 23:19:08 +00:00
Read any secret from a _FILE variable
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 3m31s
ci / announce (pull_request) Skipped
d28fac9d2d
Every secret taken from an INBUXA_MIGRATE_* variable can instead be read
from a file named by the same variable with _FILE appended -- the Docker,
Compose and systemd secrets convention. The file holds the secret and
nothing else; one trailing newline is stripped. Setting both a variable
and its _FILE form is rejected.

This keeps a secret out of both the environment and the command line,
consistently across every source, with no per-source flags. The rule
lives in the one place every secret already funnels through,
secret::from_env; the EWS client secret, which was read with a bare
env::var, now goes through it too and gains the same support.
jcoffey-dev merged commit 76a4823b54 into main 2026-11-12 23:22:49 +00:00
jcoffey-dev deleted branch feat/migrate-secret-files 2026-11-12 23:22:49 +00:00
Sign in to join this conversation.