cfg4k icon indicating copy to clipboard operation
cfg4k copied to clipboard

Vault Config

Open tobad357 opened this issue 6 years ago • 3 comments

I would be interested to load configs from Vault Would that be best implemented as a source or a provider?

tobad357 avatar Apr 16 '18 13:04 tobad357

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?

jdiazcano avatar Apr 16 '18 22:04 jdiazcano

If using the Vault Java Client then it returns a String

// Read operation
final String value = vault.logical()
                       .read("secret/hello")
                       .getData().get("value");

JavaDoc Java Client

tobad357 avatar Apr 17 '18 01:04 tobad357

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

jdiazcano avatar Apr 17 '18 07:04 jdiazcano