Skip to content

Instantly share code, notes, and snippets.

@kodaka
Last active August 3, 2019 04:14
Show Gist options
  • Save kodaka/9fb6015a67a7cf863a8ee5434c279a68 to your computer and use it in GitHub Desktop.
Save kodaka/9fb6015a67a7cf863a8ee5434c279a68 to your computer and use it in GitHub Desktop.
title date tags
Wondering Way to Merge YAML
2019-07-01 23:30:00 +0900
yaml

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment