-
Notifications
You must be signed in to change notification settings - Fork 906
[Merged by Bors] - Pass EL JWT secret key via cli flag #3568
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
Conversation
Thanks for the contribution @mariuspod. It looks like |
thanks for the hint, I've just pushed another commit after running the formatter. |
@paulhauner if there's anything I could change for this PR, please let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heyo, apologies for the delay here. I think this got swept up in all the merge excitement.
Thanks for this contribution, especially for implementing a test and updating the documentation ❤️ I have a few suggestions, please let me know what you think :)
…cret-key and --execution-jwt as conflicting.
@paulhauner Thanks for your review! I agree to all of your recommendations and have updated the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, just a couple more along the same lines 🙏
beacon_node/src/config.rs
Outdated
use std::io::Write; | ||
secret_file = client_config.data_dir.join(DEFAULT_JWT_FILE); | ||
let mut jwt_secret_key_file = File::create(secret_file.clone()) | ||
.expect("Error while creating jwt_secret_key file!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this on the last review sorry, but this expect
will panic. Something like this would be more suitable:
.expect("Error while creating jwt_secret_key file!"); | |
.map_err(|e| "Error while creating jwt_secret_key file: {:?}")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's nice! So this handles the error and exits early without panicking, very cool. Will implement it like you proposed.
beacon_node/src/config.rs
Outdated
.expect("Error while creating jwt_secret_key file!"); | ||
jwt_secret_key_file | ||
.write_all(jwt_secret_key.as_bytes()) | ||
.expect("Error occured while writing to jwt_secret_key file!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above 🙏
I've added a call to Anyways the tests are passing on my local machine with this 🎉 |
nvm, just tried without the format! and then the compiler gives a warning about the unused var so I guess no magic here 😅
|
for some reason this test failed only on windows. It seems unrelated to my changes: |
@mariuspod Yeah that's a spurious failure. A flaky test that sometimes fails on slow hardware (we'll make it less flaky... soon). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the contribution ❤️
This is ready to be merged with the next bors batch!
bors r+ |
## Proposed Changes In this change I've added a new beacon_node cli flag `--execution-jwt-secret-key` for passing the JWT secret directly as string. Without this flag, it was non-trivial to pass a secrets file containing a JWT secret key without compromising its contents into some management repo or fiddling around with manual file mounts for cloud-based deployments. When used in combination with environment variables, the secret can be injected into container-based systems like docker & friends quite easily. It's both possible to either specify the file_path to the JWT secret or pass the JWT secret directly. I've modified the docs and attached a test as well. ## Additional Info The logic has been adapted a bit so that either one of `--execution-jwt` or `--execution-jwt-secret-key` must be set when specifying `--execution-endpoint` so that it's still compatible with the semantics before this change and there's at least one secret provided.
Build failed (retrying...): |
## Proposed Changes In this change I've added a new beacon_node cli flag `--execution-jwt-secret-key` for passing the JWT secret directly as string. Without this flag, it was non-trivial to pass a secrets file containing a JWT secret key without compromising its contents into some management repo or fiddling around with manual file mounts for cloud-based deployments. When used in combination with environment variables, the secret can be injected into container-based systems like docker & friends quite easily. It's both possible to either specify the file_path to the JWT secret or pass the JWT secret directly. I've modified the docs and attached a test as well. ## Additional Info The logic has been adapted a bit so that either one of `--execution-jwt` or `--execution-jwt-secret-key` must be set when specifying `--execution-endpoint` so that it's still compatible with the semantics before this change and there's at least one secret provided.
Build failed (retrying...): |
## Proposed Changes In this change I've added a new beacon_node cli flag `--execution-jwt-secret-key` for passing the JWT secret directly as string. Without this flag, it was non-trivial to pass a secrets file containing a JWT secret key without compromising its contents into some management repo or fiddling around with manual file mounts for cloud-based deployments. When used in combination with environment variables, the secret can be injected into container-based systems like docker & friends quite easily. It's both possible to either specify the file_path to the JWT secret or pass the JWT secret directly. I've modified the docs and attached a test as well. ## Additional Info The logic has been adapted a bit so that either one of `--execution-jwt` or `--execution-jwt-secret-key` must be set when specifying `--execution-endpoint` so that it's still compatible with the semantics before this change and there's at least one secret provided.
## Proposed Changes In this change I've added a new beacon_node cli flag `--execution-jwt-secret-key` for passing the JWT secret directly as string. Without this flag, it was non-trivial to pass a secrets file containing a JWT secret key without compromising its contents into some management repo or fiddling around with manual file mounts for cloud-based deployments. When used in combination with environment variables, the secret can be injected into container-based systems like docker & friends quite easily. It's both possible to either specify the file_path to the JWT secret or pass the JWT secret directly. I've modified the docs and attached a test as well. ## Additional Info The logic has been adapted a bit so that either one of `--execution-jwt` or `--execution-jwt-secret-key` must be set when specifying `--execution-endpoint` so that it's still compatible with the semantics before this change and there's at least one secret provided.
Proposed Changes
In this change I've added a new beacon_node cli flag
--execution-jwt-secret-key
for passing the JWT secret directly as string.Without this flag, it was non-trivial to pass a secrets file containing a JWT secret key without compromising its contents into some management repo or fiddling around with manual file mounts for cloud-based deployments.
When used in combination with environment variables, the secret can be injected into container-based systems like docker & friends quite easily.
It's both possible to either specify the file_path to the JWT secret or pass the JWT secret directly.
I've modified the docs and attached a test as well.
Additional Info
The logic has been adapted a bit so that either one of
--execution-jwt
or--execution-jwt-secret-key
must be set when specifying--execution-endpoint
so that it's still compatible with the semantics before this change and there's at least one secret provided.