cfg4k
cfg4k copied to clipboard
Vault Config
I would be interested to load configs from Vault Would that be best implemented as a source or a provider?
I am unsure how Vault works. But here's more or less the rule of thumb.
A source is what gives you a Stream of the data bytes that will be read by a Loader. As I am not sure how Vault works, could you tell me what it returns when asking for something?
If using the Vault Java Client then it returns a String
// Read operation
final String value = vault.logical()
.read("secret/hello")
.getData().get("value");
Then you can use it as a Loader. The loader will just return the raw data and the provider is the one that will present it to you in a nice way.
But you need to do one change that is transforming the data. Right now it used dots as separator so you would have to transform it into slashes before querying vault