title | date | tags | |
---|---|---|---|
Wondering Way to Merge YAML |
2019-07-01 23:30:00 +0900 |
|
With merge
, YAML can be more readable and easy to configure.
# some-app-config.yaml
default: &default
server: example.com
port: 8080
user: test-foo
passwprd: test-bar
environments:
test:
<<: *default
production:
<<: *default
user: foo
password: bar
But this is not good
if "some-app" would need the config for default
key.
We do not know all config-keys of "some-app",
so what we can do is getting key of &default
more unique
that (probably) some-app does not use it.
my-awsome-default: &default
# or
_default: &default
Is it beautiful way to be underscored?