Files
EnvBao/docs/usage.md
T
mattandClaude Sonnet 5.5 d5636c46c7
test / test (push) Failing after 2s
release / validate (push) Successful in 2s
release / build (linux-amd64, linux-amd64) (push) Successful in 38s
release / build (macos-arm64, macos-arm64) (push) Successful in 45s
release / build (linux-arm64, linux-arm64) (push) Successful in 1m19s
release / release (push) Successful in 15s
Initial implementation of EnvBao
Single-binary CLI that injects environment variables from an OpenBao
server into the shell via eval "$(envbao)".

- Strict permission policy for ~/.envbao (exits 78 if unsafe)
- KV v1/v2 engine with auto-detection, pluggable engine registry
- Safe quoting for bash/zsh/sh/fish, protected-variable denylist
- Audit logging (stderr, private rotating file, syslog); no secrets logged
- Gitea pipelines for tests and SemVer-tag releases
- PyInstaller spec, docs, BSD-3-Clause licence

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 21:20:15 +01:00

52 lines
1.7 KiB
Markdown

# Usage
```
envbao [--config PATH] [--shell {auto,bash,zsh,sh,fish}] [-v|-vv] [--check | --init]
envbao --version
```
| Option | Description |
|--------|-------------|
| *(none)* | Fetch all queries and print export statements to stdout. |
| `--config PATH` | Use another config file. Its **parent directory** is the one permission-checked. |
| `--shell` | Output dialect. `auto` (default) picks from `$SHELL`; unknown shells get POSIX syntax. |
| `--check` | Validate permissions, config and token (via `auth/token/lookup-self`). Prints nothing to stdout. |
| `--init` | Create `~/.envbao` (0700) and a template `config.toml` (0600). Never overwrites. |
| `-v` / `-vv` | Show INFO / DEBUG messages on stderr. |
## Shell integration
bash / zsh:
```sh
command -v envbao >/dev/null && eval "$(envbao)"
```
fish (`~/.config/fish/config.fish`):
```fish
type -q envbao; and envbao | source
```
**Behaviour on failure:** stdout is empty and the exit code is non-zero, so `eval` does nothing and
your shell starts normally; the reason is printed to stderr and logged. If you prefer silence at
shell start-up, append `2>/dev/null` (details remain in `~/.envbao/envbao.log`).
## Output
Values are always single-quoted, so they can never be interpreted as shell syntax:
```sh
export DATABASE_URL='postgres://u:p@h/db'
export MYAPP_GREETING='it'"'"'s fine'
```
Non-string secret values (numbers, booleans, nested objects) are converted to JSON text.
Later `[[query]]` tables override earlier ones; overrides are logged.
## Logs
Records go to stderr (WARNING+ by default), the system log (WARNING+, best effort), and
`~/.envbao/envbao.log` (INFO+, mode 0600, rotated at 256 KiB, 3 backups). The log contains paths,
variable *names*, counts and outcomes only.