I was coding a configuration in YAML for node.js and needed to override the defaults of a configuration, so I added the node-config-yml library to my project and added the following to `index.js`:
const cfg = require("node-config-yml");
const path = require("path");
cfg.load(path.join("config", "overrides", "config.yml"));
console.log(cfg.data);
**index.js**
----------
#include ../config.yml
email: 'bob@bob.com'
experience: *WebdevExperience
**./overrides/config.yml**
----------
experienceList:
- webDevXetex: &WebdevExperience
posName: 'Web Dev'
companyName: 'Precision Business Systems'
city: 'Reading'
state: 'PA'
startYear: '2008'
endYear: '2010'
- webDevXetex: &PlumberExperience
posName: 'Plumber'
companyName: 'Piping Plumbers'
city: 'Johnstown'
state: 'PA'
startYear: '2006'
endYear: '2008'
company: 'ABC Company'
job: Plumber
email: tom@tmail.com
experience: *PlumberExperience
**./config.yaml**
----------
And the resulting config (or at least the important part of it) is something like this:
...
endYear: '2008'
company: 'ABC Company'
job: Plumber
email: bob@bob.com
experience:
- posName: 'Web Dev'
companyName: 'Precision Business Systems'
city: 'Reading'
state: 'PA'
startYear: '2008'
endYear: '2010'
Note that the `./config.yml` file has it's values overridden by `./overrides/config.yml`
Can this same thing be done with puppet YAML config files? And do I need a certain version of puppet, or installation of a particular plugin to achieve this?
↧