We have a project with huge configuration files built using hocon configs.
There is an intention to use variables to create template_section
and set up some values in the template based on some options.
The problem is that while using variables
in this config, I have to refer to the absolute path all the time.
Is it possible somehow to use the canonical name (if properties located on the same level)?
Example:
foo {
bar = 4
baz = ${foo.bar} // work perfect
baz = ${[this].bar} // can I do smth like that? Any ideas.
}
A more real-life example. What I'm actually looking for is general OOP abilities in building hocon configs.
I have some parent configuration template_config
with important_option
inside that really depends on implementation:
custom_config1
or custom_config2
, I currently have to implement important_option
in both child configurations because with absolute paths, I have to refer to custom config sections names.
custom_config1: $template_config {
child_option = child_value1
}
custom_config2: $template_config {
child_option = child_value2
}
template_config {
important_option = ${child_option} // NOT POSSIBLE
child_option = not_implemented
}
template_config.child_option
. – Octopusouter { list : [ { anonymous : config }, { another : config } ] }
– Hawaii