Skip to content

feat(cli): add GANDER_CONFIG profile selector for non-prod gandermd - #55

Merged
scott merged 1 commit into
mainfrom
feat/54-gander-config-profile
Aug 20, 2026
Merged

feat(cli): add GANDER_CONFIG profile selector for non-prod gandermd#55
scott merged 1 commit into
mainfrom
feat/54-gander-config-profile

Conversation

@scott

@scott scott commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • configPath() now honors GANDER_CONFIG=<name> → reads and writes ~/.gander.<name> instead of ~/.gander. The two files are fully isolated — no field-level mutation, no WriteConfig workaround — so running the CLI against a local dev or staging gandermd never disturbs the prod profile.
  • Profile names validated against path traversal (rejects ., .., /, \). Legacy ~/.mdp fallback still applies to the default profile only.
  • Tests cover: env branch + isolation from primary, traversal rejection (4 subcases), and legacy .mdp bypass for named profiles.
  • README, man page, AGENTS.md all updated with the new env var.

Paired with

gandermd/gandermd#37 — server-side make dev workflow that uses GANDER_CONFIG=dev via a bin/gander-local wrapper. Per gandermd/AGENTS.md ("CLI pairing"), ship in the same release cycle.

Local loop after merge

# terminal 1 (server repo)
make dev                                # provisions gandermd_dev DB, boots :7331

# terminal 2 (server repo, after make dev-cli)
./bin/gander-local signup --email dev@example.com
./bin/gander-local share README.md
./bin/gander-local list

Prod gander on $PATH keeps using ~/.gander. The wrapper only exists at bin/gander-local in the server repo. ~/.gander and ~/.gander.dev never interact.

Acceptance criteria

  • GANDER_CONFIG=dev gander signup --email foo@bar.com creates ~/.gander.dev; ~/.gander is byte-identical before and after.
  • GANDER_CONFIG=dev gander share README.md posts to localhost:7331 and persists share mapping into ~/.gander.dev.
  • Without GANDER_CONFIG, behavior is identical to before — including the .mdp legacy fallback.
  • Two concurrent profiles don't collide.
  • GANDER_CONFIG=../escape errors out cleanly.

Closes #54.

configPath() now honors GANDER_CONFIG=<name> by reading and writing
~/.gander.<name> instead of ~/.gander. The two files are fully isolated —
no field-level mutation, no WriteConfig workaround — so running the CLI
against a local dev or staging gandermd never disturbs the prod profile.

Profile names are validated: rejects '.', '..', '/', '\' to prevent path
traversal. The legacy ~/.mdp fallback still applies to the default
profile but never to named profiles.

Closes #54.
@scott

scott commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

/oc please review this PR and approve if you find it ready to merge

@scott
scott merged commit 22e30e4 into main Aug 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GANDER_API_URL env override to point CLI at a local/self-hosted gandermd

1 participant