Suppose I have 2 YAML files:
1) application.yml
en:
variable: "Hello World"
2) user.yml
en:
variable: <Here I want to get value from application.yml -> "Hello World" >
At first I though that I might use referencing:
1) application.yml
en:
variable: &variable "Hello World"
2) user.yml
en:
variable: *variable
But turned out that it is only possible for items declared in one file. Is there any way I can get the value from the variable defined in application.yml ?
So the only way is to create another, third file that would hold shared values. Or to use the value from "application.yml".
YAML references are intra-file.
You could also have a preprocessing step where you merge YAML files.
In *nix shell:
cat foo.yaml bar.yaml > baz.yaml
In Powershell:
cat foo.yaml, bar.yaml > baz.yaml
In batch:
type foo.yaml bar.yaml > baz.yaml
References
Look Ma, No Tags!
Powershell cmdlets: get-content
cat
COPY Concatenates Files Based on Command Syntax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With