-
Notifications
You must be signed in to change notification settings - Fork 190
Description
Currently VaultPropertySourceRegistrar, when registering vault property sources, adds property transformer depending on @VaultPropertySource propertyNamePrefix attribute, either transformer that appends prefix, or noop, if no propertyNamePrefix specified.
Please allow specifying more custom transformers as attribute in @VaultPropertySource, e. g. as array of classes, that implement PropertyTransformer interface. PropertyTransformer allows chaining, so additional transformers
could be added on top of default one (prefix transformer or noop).
Why?
There is a necessity to remap property names, returned by vault from dynamic auth backends, directly to spring Environment, with names, as various autoconfigurations expect them, to avoid explicit bean redefinitions.
For example, postgres dynamic credential provider returns secret {"username": "u", "pwd": "p", "url": "postgres:jdbc://"}, what i can do now is only append prefix to those properties, but it would be very convenient to map these properties to spring.data.datasource.user, spring.data.datasource.password and so on, so that spring could build DataSource automatically, without defining DataSource bean explicitly.
And resulting @VaultPropertySource would look like
@VaultPropertySource( value = "db/postgres", renewal = VaultPropertySource.Renewal.RENEW, ignoreSecretNotFound = false, propertyTransformers = { MyPropertyTransformer.class } )