classyconf
classyconf copied to clipboard
Feature request - load configuration from HashiCorp Vault
This is slightly a different case for loaders since it is not local but we use Vault \ Secrets Manager to hold configuration data such as DB URL, password, etc (which are different per env).
This would be really cool, does it need a new dependency? If so, I think it should be optional. Another possibility is to provide this loader as a separate package like classyconf-vault
?
Something to consider is that we would need to have a "configuration of the configuration" since the loader would need to be configured:
VaultLoader(
url='https://localhost:8200',
token='asdf',
namespace='/test/'
)
So the loader would need to get this params from somewhere
class VaultConf(ClassyConf):
VAULT_URL = Value(default="https://localhost:8200")
VAULT_TOKEN = Value()
VAULT_NAMESPACE = Value()
class Meta:
loaders = [ EnvFile(".env") ]
vault_conf= VaultConf()
vault_loader = VaultLoader(
url=vault_conf.VAULT_URL,
token=vault_conf.VAULT_TOKEN,
namespace=vault_conf.VAULT_NAMESPACE
)
ini_loader = IniFile("another_conf.ini")
class MyAppConf(ClassyConf):
class Meta:
loaders = [ vault_loader, ini_loader ]
Makes sense?