DopplerHQ / cli

The official CLI for interacting with your Doppler secrets and configuration.
https://docs.doppler.com
Apache License 2.0
219 stars 44 forks source link

Throw an error if a non-existent secret is requested from secrets get #215

Closed apazzolini closed 3 years ago

apazzolini commented 3 years ago

If you request a secret that doesn't exist, we currently return an empty string. This PR changes the behavior to throw an error if the secret was not found. If you request multiple secrets, they must all exist, or an error will be thrown.

» doppler secrets get X
Doppler Error: Could not find requested secret: X

» doppler secrets get DOPPLER_PROJECT X
Doppler Error: Could not find requested secret: X

» doppler secrets get X Y
Doppler Error: Could not find requested secrets: X, Y

Closes ENG-1753.

Piccirello commented 3 years ago

This looks great! There's one minor issue: this is a breaking change. If you were previously requesting a non-existent secret, you'd get a blank string, but now you'll get an error. Given the very specific use case I think we may be able to release this as a minor version bump without breaking too many people's flows. Though we may want to add a flag so that if a user's setup does break, they have recourse to restore the original behavior. Wdyt about a new no-exit-on-missing-secret flag (or something similarly named)?

apazzolini commented 3 years ago

Definitely agree with that change. The flag name is good, matches no-exit-on-write-failure.