Is it possible to reference another configuration in a YAML file?
pecuerre opened this issue · 2 comments
pecuerre commented
Let me explain. I think the title might not be clear.
I would like to do something like:
color:
front: '000000'
back: 'FFFFFF'
text:
size: 10
family: Arial
color: <%= Settings.color.front %> # or some similar syntax
but when I put this it says uninitialized constant Settings
.
is it possible to do that? is it a workaround some how?
basically what i want to do is define one value that depends on another value.
cjlarose commented
YAML itself has support for anchors and references, so in your case you can do something like this:
color:
front: &front-color '000000'
back: 'FFFFFF'
text:
size: 10
family: Arial
color: *front-color
See the YAML 1.2 specification section 6.9.2 for more details
pecuerre commented
Oh, thanks. It didn't occurred to me to look in the YAML documentation.