You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: make all cli flags available as env variables (opt-in) #3
Auto-mapping via FromEnv -- maps all flags automatically using a prefix. Unlike ff, the subcommand name is included, so myapp serve --port maps to MYAPP_SERVE_PORT instead of just MYAPP_PORT, avoiding collisions when subcommands share flag names.
Activity
mfridman commentedon Feb 16, 2026
Priority: CLI args > env vars > flag defaults
Two opt-in mechanisms that work together:
Per-flag via
FlagMetadata.Env-- explicit, no magic. Useful when env var names don't follow a pattern (e.g.,DATABASE_URL).Auto-mapping via
FromEnv-- maps all flags automatically using a prefix. Unlike ff, the subcommand name is included, somyapp serve --portmaps toMYAPP_SERVE_PORTinstead of justMYAPP_PORT, avoiding collisions when subcommands share flag names.If a flag has an explicit
Env, it takes precedence over the auto-generated name.