config icon indicating copy to clipboard operation
config copied to clipboard

configuration-controlled config value transformation

Open radist-nt opened this issue 5 years ago • 0 comments

Feature requests related to preprocessing of configuration values before reading were opened twice, but it was limited to transparent decryption of configuration values: #6 and #96. Let me open this question one more time.

Firstly, I want to refer to the configuration engines which delivers (or could deliver) this feature:

  • YAML by design has a tag mechanism (as it stated in https://github.com/lightbend/config#rationale-for-supported-file-formats)
  • Apache DeltaSpike (library which resolves some problems in JSR-299) uses java properties for configuration but provides the ConfigFilter interface for modification of values between config files and code which reads it. It could be used to append a transformation.

Actual usecase for preprocessing of configuration values are:

  • reading messages into configuration from database or another configuration source.
  • providing calculation of values
  • password decryption (it's userfull for deploying the software if the actual developer should not know the encryption method)
  • randomization of the configured values (i.e. for testing purposes)

How to implement: java has a SPI feature which could be used to provide the class used for transformation. The jar file with the transformation implementation could be added to the classpath without accessing to the code which reads the configuration.

radist-nt avatar May 22 '20 19:05 radist-nt