I am trying to use js-yaml to import a yml file into a js file. The main yml file contains variables referenced in another file.
I am trying to find a way to get import the values of those extra references, but when I use safeLoad or load, the file loads in just the reference (not the actual value).
Below is what the files look like, the expected outcome, and the actual outcome.
Thanks for your help!
main.yml file
otherAttribute:
bar: 'foo'
custom: ${file(otherFile.yml)}
RotherFile.yml file
key1: value
key2: value
js file
yaml = require("js-yaml");
var example = yaml.load(fs.readFileSync("./main.yml", "utf8"));
console.log('value of example read in via yaml.load',example);
Desired Output
otherAttribute:
bar: 'foo'
custom:
key1: value
key2: value
Actual Output
otherAttribute:
bar: 'foo'
custom: ${file(otherFile.yml):${self:otherAttribute.bar}}