| 1 | # Of course, if expansion was possible using anchors and tags, it would |
|---|
| 2 | # logically make sense to be able to anchor an item that is itself referencing |
|---|
| 3 | # another item, in order to chain expansions. |
|---|
| 4 | # |
|---|
| 5 | # A simulated real-world example: |
|---|
| 6 | |
|---|
| 7 | database_pool: |
|---|
| 8 | - &default |
|---|
| 9 | host: 10.10.10.1 |
|---|
| 10 | port: 53000 |
|---|
| 11 | user: my_user |
|---|
| 12 | passwd: S3kr1t |
|---|
| 13 | db: my_db |
|---|
| 14 | - *default &secondary |
|---|
| 15 | host: 10.10.10.2 |
|---|
| 16 | - *secondary |
|---|
| 17 | port: 53001 |
|---|
| 18 | |
|---|
| 19 | # Theoretically, the above would expand to this (JSON): |
|---|
| 20 | |
|---|
| 21 | { |
|---|
| 22 | "database_pool": [ |
|---|
| 23 | { |
|---|
| 24 | "passwd": "S3kr1t", |
|---|
| 25 | "host": "10.10.10.1", |
|---|
| 26 | "db": "my_db", |
|---|
| 27 | "port": 53000, |
|---|
| 28 | "user": "my_user" |
|---|
| 29 | }, |
|---|
| 30 | { |
|---|
| 31 | "passwd": "S3kr1t", |
|---|
| 32 | "host": "10.10.10.2", |
|---|
| 33 | "db": "my_db", |
|---|
| 34 | "port": 53000, |
|---|
| 35 | "user": "my_user" |
|---|
| 36 | }, |
|---|
| 37 | { |
|---|
| 38 | "passwd": "S3kr1t", |
|---|
| 39 | "host": "10.10.10.2", |
|---|
| 40 | "db": "my_db", |
|---|
| 41 | "port": 53001, |
|---|
| 42 | "user": "my_user" |
|---|
| 43 | } |
|---|
| 44 | ] |
|---|
| 45 | } |
|---|