sksamuel / hoplite

A boilerplate-free Kotlin config library for loading configuration files as data classes
Apache License 2.0
924 stars 74 forks source link

Prefix binding #415

Closed rocketraman closed 4 months ago

rocketraman commented 7 months ago

Modify ConfigLoader and ConfigParser so that the config is parsed only a single time. ConfigLoader.configBinder() can now be called to obtain the instance of a new class ConfigBinder, which can in turn be used to bind the already parsed config to multiple data classes, given a prefix.

This follows the general approach as suggested by @cloudshiftchris.

~This PR is stacked on top of https://github.com/sksamuel/hoplite/pull/414 and will be rebased and moved out of draft once that PR is merged.~

Replaced by PR https://github.com/sksamuel/hoplite/pull/422.