StringArray flags don't support multiple values via environment variables
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 102
- Forks
- 49
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 16
Description
Environment variables for StringArray flags (e.g. FGA_CUSTOM_HEADERS, FGA_API_SCOPES) only support a single value. Setting multiple values via env var silently produces one entry containing the entire string, which either fails parsing or is ignored.
Example:
FGA_CUSTOM_HEADERS="X-Foo: bar,X-Baz: qux" fga store list
# Results in one invalid header entry "X-Foo: bar,X-Baz: qux"
# instead of two separate headers
Root cause:
BindViperToFlags (internal/cmdutils/bind-viper-to-flags.go) passes the viper value through fmt.Sprintf("%v", value). When the value comes from an env var, viper returns a plain string — there's no splitting logic. The YAML config file path works correctly (viper returns a []any slice which is now handled), but env vars do not.
Affected flags:
--custom-headers/FGA_CUSTOM_HEADERS--api-scopes/FGA_API_SCOPES
Workaround:
Use the config file (~/.fga.yaml) instead:
custom-headers:
- "X-Foo: bar"
- "X-Baz: qux"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in internal/cmdutils/bind-viper-to-flags.go at BindViperToFlags and reproduce the issue with FGA_CUSTOM_HEADERS or FGA_API_SCOPES. Verify how environment-variable strings are converted compared with the YAML slice path. Done means multiple environment-variable values become separate flag entries without regressing config-file behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100