feat(profiles): manage gateway headers from the CLI - #109
Merged
Conversation
A profile could carry extra request headers for a gateway that authenticates OpenFGA itself, but nothing could set them: `profiles set`/`unset` had no headers key, and `profiles show` never rendered them, so hand-editing config.toml was the only way. `ofga profiles set headers 'Name: value' ...` now sets the list (replacing it), `ofga profiles unset headers` clears it, and both show views report the configured header names. Values are never printed — a header configured here is a gateway credential. Reserved and malformed headers are rejected before anything is written. Scopes also accept either separator now, in both `profiles add --scopes` and `profiles set scopes`, matching what OPENFGA_SCOPES has always done.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
A profile can carry extra request headers, for deployments that put OpenFGA behind a gateway with its own header-based authentication. Nothing in the CLI could manage them:
profiles set/profiles unsethad noheaderskey,profiles showandprofiles listnever rendered them, and the only documented way to configure one was hand-editingconfig.toml.set headerstakes every header in one command and replaces the profile's list, which keeps "set" meaning assign. Values are never rendered or emitted — a header configured here is a gateway credential, so the human view and--json(header_names) both report names only. Reserved headers (Authorization, which the SDK would silently drop) and malformed ones are rejected before anything is written to the config.Also folded in:
--scopesaccepted commas inprofiles addbut spaces inprofiles set scopes, for the same field. Both now take either, which is whatOPENFGA_SCOPEShas always done.🏷 Type of change
✅ How to verify
Driven end to end against an isolated config: setting two headers, replacing them,
showin both human and JSON form,unset, rejection ofAuthorization: …, and that a scalar key likestore_idstill refuses a second value. The generated command reference is regenerated (make docs-reference).📋 Checklist
--help/ examples) if behavior changed —set/unsethelp and examples, plus the generated referencemake checkpasses locally