Skip to content

feat: Add OpenFGA server version to fga --version command#488

Closed
Siddhant-K-code wants to merge 2 commits intoopenfga:mainfrom
Siddhant-K-code:ft/274
Closed

feat: Add OpenFGA server version to fga --version command#488
Siddhant-K-code wants to merge 2 commits intoopenfga:mainfrom
Siddhant-K-code:ft/274

Conversation

@Siddhant-K-code
Copy link
Member

Description

This PR adds the OpenFGA server version display to the fga --version command. When the CLI is configured with an API URL, it will show both the CLI version and the server version.

Changes

  • Added GetServerVersion function to retrieve server version
  • Modified version command to display server version when available
  • Added proper error handling and "unknown" fallback

Example Output

$ fga --version
fga CLI version v0.2.6 (commit: dc4e39648ec5b626fc5c44c4f9f77a1e15806ab7, date: 2024-02-28T12:47:25Z)
openfga version v1.5.0

If the server version cannot be retrieved, it will display:

$ fga --version
fga CLI version v0.2.6 (commit: dc4e39648ec5b626fc5c44c4f9f77a1e15806ab7, date: 2024-02-28T12:47:25Z)
openfga version v unknown

References

fixes #274

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@Siddhant-K-code Siddhant-K-code requested a review from a team as a code owner April 19, 2025 14:46
@Siddhant-K-code
Copy link
Member Author

image

These should be fixed by #485 soon

Copy link
Member

@rhamzeh rhamzeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're printing out the Store ID - what we want is the actual OpenFGA server version.

There's 2 of those, remote and local.

The remote it is impossible to do without server support. The local version, there may be a way to print out the version (from the go.mod/go.sum entry), but I don't think it's going to be straightforward.

@Siddhant-K-code Siddhant-K-code deleted the ft/274 branch April 21, 2025 11:25
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.

fga --version should return the version of the OpenFGA server

2 participants

Comments