-
Notifications
You must be signed in to change notification settings - Fork 6
fix(settings): get message data hmac key setting to work with env variables #110
Conversation
config/default.json
Outdated
@@ -19,7 +19,9 @@ | |||
{ "period": "5 minutes", "limit": 0 } | |||
] | |||
}, | |||
"message_id_hmac_key": "YOU MUST CHANGE ME", | |||
"messagedata": { | |||
"hmackey": "YOU MUST CHANGE ME" |
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.
Fwiw, I maintain my position that we don't need nesting for this and could just have it at the top level (see discussion in #72 (comment)). Not sure what everyone else thinks though, so ignore me if you guys disagree.
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.
If we really want to keep the nesting though, maybe it should be inverted in this case. Make hmackeys
the parent property and then we can have all the different instances that we imagine we want underneath it as children.
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 agree that the nesting is a bit much, but I still think FXA_EMAIL_MESSAGEDATAHMACKEY
is just too long. I do like the initial solution that you had for this, FXA_EMAIL_HMACKEY
. I will take a look at the environment separator you mentioned and see if we can keep the underscores after all, if we don't, I will still remove the nesting :)
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.
Oh yeah, I definitely didn't mean FXA_EMAIL_MESSAGEDATAHMACKEY
that's way too ugly. But FXA_EMAIL_HMACKEY
is fine I think.
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.
(but I think @vladikoff disagrees, so let's see what he says)
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'm sold! I just want my ENV var :)
It's definitely not a bug in |
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.
r+, modulo whatever decision you guys want to make about dropping the messagedata
nesting. I don't think it adds any value and would prefer to drop it on the basis of YAGNI.
So, apparently the This is how this affects us: if we keep using the version of Regarding having underscores in our settings names, if we are really gonna stick with using underscores as our default separator we can't do that, because whenever we have underscore
and not what we are actually expecting it to overwrite, which is:
This is just something that is nice to know, because I think the solution for the problem that I introduced in this PR (just remove the underscores) is good enough and we shouldn't spend much more time on this. The other solution would be to use another separator to indicate nesting instead of underscores, but that would mean we would have to change ALL our environment variables for settings. Anyways, let me know what you guys think about this, if we should use another separator or just stick with what we have now. |
Fwiw, my recollection is that we made a conscious decision not to have underscores in setting names back when we did #11, although I can't find a comment about it in that PR so possibly I've misremembered. Anyway, whatever, let's keep on doing that is my thinking. The one you're fixing here was definitely accidental. |
@@ -19,7 +19,7 @@ | |||
{ "period": "5 minutes", "limit": 0 } | |||
] | |||
}, | |||
"message_id_hmac_key": "YOU MUST CHANGE ME", | |||
"hmackey": "YOU MUST CHANGE ME", |
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.
👍
Fixes #109
Because we had underscores in the name of this setting, it wasn't getting overwritten by an
FXA_EMAIL_
environment variable. At first I thought this was a bug withconfig-rs
but it actually looks like a design choice, because they use underscores to signal nesting. For example:Will get overwritten by the environment variable
FXA_EMAIL_AUTHDB_BASEURI
.Anyways, to fix this I changed the
message_id_hmac_key
setting to not have any underscores. Since that was too long for just removing the underscores, I did a little nesting for the resulting environment variable to look nicer. Now, to overwrite the hmac key we can just useFXA_EMAIL_MESSAGEDATA_HMACKEY
.I also added that to our settings tests, so that we can make sure it works.
Finally, I remember @philbooth commenting that this is sensitive data that we should probably hide when logging. Should I add a deserializer macro to hide this?
r? @philbooth @vladikoff
[UPDATE]
Looking at
config-rs
source code made me wonder if this really isn't a bug... I filed an issue there (rust-cli/config-rs#73) and will try to investigate it.