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

Full version #101

Merged
merged 5 commits into from
Aug 16, 2022
Merged

Full version #101

merged 5 commits into from
Aug 16, 2022

Conversation

alexsnaps
Copy link
Member

@alexsnaps alexsnaps commented Aug 2, 2022

This adds a more explicit version string (version, as per the Cargo.toml, the profile used to build if not release and the git sha), to the --help & --version but also logs it to stdout on startup as well as to the logs (INFO). The idea is that we have good traceability for when "something goes wrong".

Example

$ ./limitador-server ./limitador-server/examples/limits.yaml
Limitador Server debug build v0.5.1 (b3509e30)

At INFO log level, you get the version as well, and the dump of the actual config that'll be used

$ ./limitador-server -vv ./limitador-server/examples/limits.yaml
Limitador Server debug build v0.5.1 (b3509e30)
[2022-08-02T14:01:06Z INFO  limitador_server] Version debug build v0.5.1 (b3509e30)
[2022-08-02T14:01:06Z INFO  limitador_server] Using config: Configuration { limits_file: "./limitador-server/examples/limits.yaml", storage: InMemory, rls_host: "0.0.0.0", rls_port: 8081, http_host: "0.0.0.0", http_port: 8080, limit_name_in_labels: false, log_level: Some(Info) }

if the directory tree isn't "clean", i.e. has uncommited changes

The -dirty suffix is added to the sha

$ ./limitador-server ./limitador-server/examples/limits.yaml
Limitador Server debug build v0.5.1 (2a57743d-dirty)

Logs the profile target

If it's not release:

$  ./target/debug/limitador-server --version
Limitador Server v0.5.1 (aa83d91e) debug build

finally, if git can't be executed, or this isn't build of a fork

Instead of the sha, you get unknown

$ ./limitador-server ./limitador-server/examples/limits.yaml
Limitador Server debug build v0.5.1 (unknown)

@alexsnaps alexsnaps requested a review from a team August 2, 2022 14:28
limitador-server/build.rs Outdated Show resolved Hide resolved
@alexsnaps alexsnaps force-pushed the full_version branch 3 times, most recently from 843bbd6 to 96965be Compare August 2, 2022 16:32
@alexsnaps alexsnaps merged commit a1c57a7 into main Aug 16, 2022
@alexsnaps alexsnaps deleted the full_version branch August 16, 2022 13:30
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.

2 participants