Add CLIENT_ID env var for compiling with a client id#125
Add CLIENT_ID env var for compiling with a client id#125sashahilton00 wants to merge 2 commits intomasterfrom
Conversation
|
What about |
|
Not really happy with this. This also adds some potential for unexpected runtime panics if misused. |
|
I tried to code it so that it is additive, rather than replacing the current functionality. Isn't a panic still possible in the current implementation in the event that one doesn't pass a client_id to the get_token function? @kingosticks I did think about that, but I was unsure how match would handle the Option<> that option_env! creates. |
|
I've not tried it, but if it doesn't evaluate the entire expression before matching then that would be very odd. |
|
Since This is just the wrong place to do this. We don't hardcode anything (even at build time) in the library. End applications are responsible for doing this if they want it. @kingosticks suggestion is right. You could even get rid of the match with let client_key = option_env!("CLIENT_ID").or(client_id).expect("No Client ID available"); |
|
PR updated, but prevaling view seems to be that this isn't the right place/way to implement it, hence closing this PR. |
Add CLIENT_ID env var for compiling with a client id, remove unnecessary serde_derive. If you can think of a better way than a double match statement, happy to improve this...