nymous / pydantic-vault

A simple extension to Pydantic BaseSettings that can retrieve secrets from Hashicorp Vault
MIT License
52 stars 13 forks source link

feat!: change config source priorities #25

Closed kazauwa closed 10 months ago

kazauwa commented 11 months ago

This change addresses issue https://github.com/nymous/pydantic-vault/issues/17 and changes the priorities of config sources as follows:

  1. Environment variable
  2. .vault_token file (for Vault token only)
  3. Value specified in a Config class

This makes pydantic-vault consistent with Pydantic and 12 Factor App.

kazauwa commented 11 months ago

Hey @nymous!

I took the liberty of changing the priority of a .vault_token file to make it higher than the value in a Config class. This is how it works in Pydantic and generally follows the idea we discussed in the related issue. Though we only agreed on changing the priorities of environment variables, I believe we won't achieve complete consistency with Pydantic without this change. Let me know what you think about this. If you're not happy with it, it's in a separate commit and can be easily reverted.

nymous commented 10 months ago

Hi! Many thanks for your contribution! With the changelog entry and everything :ok_hand:

I also find the .vault-token change in line with the rest, perfect. I just updated the README to document the new priority order, if you're ok with it then I will be happy to merge!

kazauwa commented 10 months ago

Looks good to me! Let's merge it!