tellerops / teller

Cloud native secrets management for developers - never leave your command line for secrets.
https://github.com/tellerops/teller
Apache License 2.0
2.8k stars 183 forks source link

ENV should take precedence over configuration #289

Open romans-ovo opened 2 months ago

romans-ovo commented 2 months ago

A typical expected behaviour for any options would be:

  1. take from command-line arguments (if supported)
  2. take from ENV variables
  3. take from .config-files

Looking at this code however, it seems that there is a problem: https://github.com/tellerops/teller/blob/master/teller-providers/src/providers/hashicorp_vault.rs#L61

If options are provided in the configuration they would take precedence over ENV, but more importantly if you only specify ADDRESS as an option, it will not take TOKEN from the env.

I think this behaviour could be improved to look for the value in the environment and if not found, check the opts. I'm happy to provide PR.

While I noticed the problem in Vault provider, there may be similar behaviour elsewhere, I haven't checked.