kumuluz / kumuluzee

Lightweight open-source framework for developing microservices using standard Java EE technologies and migrating Java EE to cloud-native architecture.
https://ee.kumuluz.com
MIT License
291 stars 71 forks source link

Allow sub-tree injection in configuration framework #183

Open urbim opened 3 years ago

urbim commented 3 years ago

If __kumuluzee-inject property is defined, inject all configuration from that sub-tree.

The goal is to support something like this:

config.yml:

kumuluzee:
  health:
    checks:
      kafka-health-check:
        __kumuluzee-inject: "kumuluzee.streaming.producer"
        a: 2 # override
        c: 3 # define new

  streaming:
    producer:
      a: 1 # gets overridden
      b: test # defines new
      d:
        e: nested # defines nested

This would create effective configuration:

kumuluzee:
  health:
    checks:
      kafka-health-check:
        a: 2
        b: test
        c: 3
        d:
          e: nested

  streaming:
    producer:
      a: 1
      b: test
      d:
        e: nested

This allows developers to write repeatable configuration only once (DRY) while still allowing overrides to be defined.