Skip to content
This repository was archived by the owner on Feb 28, 2023. It is now read-only.

Enable TLS support for Redis#98

Merged
Xanewok merged 2 commits intoparitytech:masterfrom
alnr:redis-tls-cachepot
Aug 9, 2021
Merged

Enable TLS support for Redis#98
Xanewok merged 2 commits intoparitytech:masterfrom
alnr:redis-tls-cachepot

Conversation

@alnr
Copy link
Contributor

@alnr alnr commented Aug 3, 2021

The corresponding PR in mozilla/sccache is here: mozilla/sccache#976

This enables TLS support for Redis. Just by fiddling with the features of the redis dependency, Cargo.lock shrank a lot.

I've also added a small improvement (masking the password in the Redis URL if there is one).

@@ -31,8 +32,12 @@ pub struct RedisCache {
impl RedisCache {
/// Create a new `RedisCache`.
pub fn new(url: &str) -> Result<RedisCache> {
let mut parsed = Url::parse(url)?;
if parsed.password().is_some() {
let _ = parsed.set_password(Some("*****"));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would prefer a wrapper type, that has an alternative Display implementation rather than this hack. At the very least this requires a comment to why this is done and a statement of the restrictions following from it.

Copy link
Contributor Author

@alnr alnr Aug 3, 2021

Choose a reason for hiding this comment

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

Hack? I would consider this the simplest possible implementation for masking the password for display.

The url member of RedisCache is used only for display purposes. How about I rename this member to displayUrl and add a comment?

Copy link
Contributor

@drahnr drahnr Aug 3, 2021

Choose a reason for hiding this comment

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

My apologies, "hack" was definitely the wrong choice of words. There is just the possibility of this being re-used in the future and not being explicit is a potential future pain point.

Renaming to display_url surely conveys this, though I would still prefer this to be generalized to a RedactedUrl impl eventually beyond the scope of the redis storage backend, but out of scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries.

Comment added.

@drahnr
Copy link
Contributor

drahnr commented Aug 3, 2021

LGTM, minor nit needs to be addressed, other than that 👍 - thank you! ❤️

@alnr alnr force-pushed the redis-tls-cachepot branch from fe952ae to f717bf5 Compare August 4, 2021 09:03
@Xanewok
Copy link
Contributor

Xanewok commented Aug 9, 2021

Looks good, thank you!

@Xanewok Xanewok merged commit b46b99b into paritytech:master Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants