[FEATURE] Dedicated command for the CLI to check if I'm already logged in
icepuma opened this issue · 7 comments
Is your feature request related to a problem? Please describe.
Hey,
I want to create an integration with the doppler
CLI. Therefore I want to check, if I'm already logged in.
Describe the solution you'd like
I thought of having a dedicated doppler me
command, which prints all the information about my login status.
Describe alternatives you've considered
Is there already a mechanism I could use for that?
Additional context
No additional context.
If you are happy with my suggestion, I would love to contribute the code! In the case you have an alternative suggestion, I would love to hear about it!
Best regards
Stefan aka icepuma
Hey @icepuma, cool idea! We don't have an API endpoint yet for fetching the current user so this solution would be a little bit more involved.
Would you be able to use doppler configure --json
to fetch your active token? If you aren't logged in, that command will return an empty object.
Yeah, the idea with doppler configure --json
and getting the token
would work! I think we can let this issue be open and implement the doppler me
feature after you folks are done with the endpoint.
I tested it and it works like a charm! Waiting for the doppler me
command though.
Great to hear! I'll share your idea with our product team, I think doppler me
(and the corresponding API endpoint) could be useful in other contexts too
@icepuma If you wanted a temporary workaround, you could add something similar to your .bash_profile
or .bashrc
:
alias doppler-me='if doppler projects &>/dev/null ; then doppler configure --json; else echo "Doppler CLI unauthenticated"; fi'
Then just run doppler-me
.
I was hooking doppler
- CLI into a another CLI via the ProcessBuilder
from Rust. Therefore I wanted to have a clear interface via exit codes (= 0 -> logged in
, > 0 -> not logged in
). But the proposed workaround from @nmanoogian did work perfectly.