Let's say I have one file, defaults.yaml
:
pool:
idleConnectionTestPeriodSeconds: 30
idleMaxAgeInMinutes: 60
partitionCount: 4
acquireIncrement: 5
username: dev
password: dev_password
and another file, production.yaml
:
pool:
username: prod
password: prod_password
At runtime, how do I read both files and merge them into one such that the application 'sees' the following?
pool:
idleConnectionTestPeriodSeconds: 30
idleMaxAgeInMinutes: 60
partitionCount: 4
acquireIncrement: 5
username: prod
password: prod_password
Is this possible with, say, SnakeYAML? Any other tools?
I know one option is to read multiple files in as Maps and then merge them myself, render the merge to a single temporary file and then read that, but that's a heavyweight solution. Can an existing tool do this already?