Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /version endpoint and --version cli flag #63

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

jgknight
Copy link
Contributor

Summary

Closes #18

Allow the server operator a way to view the current RAS version with either the CLI or API.

The CLI allows for -v, --v, -version or --version. There's also -h output

GoReleaser by default sets the main.version, main.commit, and main.date variables.

Testing

Help output

./retro_aim_server -h       
Usage of ./retro_aim_server:
  -v    Display build information
  -version
        Display build information

On a non-release build, it will show a dev version with no commit or date information.

./retro_aim_server --version
version:   dev
commit:    none
date:      unknown

curl -s localhost:8080/version | jq
{
  "version": "dev",
  "commit": "none",
  "date": "unknown"
}

I made a release build by running make release-dry-run. The latest tag I had checked out was 0.8.0 so that's the version it built with, but in a normal situation this should show the latest tag. The output shows the version, latest commit, and the date it was built.

./retro_aim_server -v
version:   0.8.0
commit:    2e0cf4181ab3cb4df6ebc4f84d7c16a591aacb8d
date:      2024-08-29T20:28:00Z

curl -s localhost:8080/version | jq
{
  "version": "0.8.0",
  "commit": "2e0cf4181ab3cb4df6ebc4f84d7c16a591aacb8d",
  "date": "2024-08-29T20:28:00Z"
}

Also added unit tests for the /version endpoint which pass

Closes mk6i#18

Allow the server operator a way to view the current RAS version
@mk6i
Copy link
Owner

mk6i commented Aug 30, 2024

very nice 🌮

@mk6i mk6i merged commit ebe48cf into mk6i:main Aug 30, 2024
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.

Implement /version endpoint
2 participants