I have two config
main config: main.conf
join {
}
required merge into main: test.conf
mergeMe {
value = "SomeValue"
}
result:
join {
test {
value = "SomeValue"
}
}
merged block named as same as the merge file`s name
I tried in kotlin:
val main = ConfigFactory.parseFile(File("main.conf")).getConfig("join")
val test = ConfigFactory.parseFile(File("test.conf")).getConfig("mergeMe")
val joined = main.withOnlyPath("test").resolveWith(test, ConfigResolveOptions.defaults()).root().render(ConfigRenderOptions.defaults()
.setComments(true)
.setFormatted(true)
.setJson(false).setOriginComments(true))
val writer = FileWriter(File("main.conf"))
writer.write(joined)
writer.flush()
writer.close()
Update: atPath will wrap config with a new path, should use getConfig("mergeMe") but still doesn't work...
It doesn't work...
How to do it?