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

nested substitutions #365

Closed slushpupie closed 1 year ago

slushpupie commented 1 year ago

Should the LookupPreprocessor handle nested substitutions? The following example does not work, but its not clear from the documentation if it even should work:

full = "This contains ${part1}"
part1 = "part1 (${subtext1})"
subtext1 = "some subtext"

It produces an error of Unresolved substitution This contains part1 (${subtext1}) at (default.conf:1)

If nested substitutions should not work, can at least the documentation be updated to clearly reflect that? I would like them to work, if that can be a feature request.

sksamuel commented 1 year ago

So in this case you expected full to be "This contains part1 (some subtext)" ?

slushpupie commented 1 year ago

Yes, that is what I expected.

sksamuel commented 1 year ago

We can make nested subscriptions work but adding it under the current syntax could break existing users code.

I'll add it under new syntax.