0

I have two sets of config groups, from which I need to select one config file each time. the file structure looks like this:

conf
├── datasets
│   ├── A
│   │   ├── a1.yaml
│   │   └── a2.yaml
│   └── B
│       ├── b1.yaml
│       └── b2.yaml
└── config.yaml

I could choose dataset config with dataset=A/a1 or dataset=B/b1, etc.

Now suppose each config file in A or B has many items in common(that's why they are grouped in two subfolders).

The question is:

How could I specify these common items in A and B, without having to specify them in each config file under these folders?

The resulting file structure may look like this:

conf
├── datasets
│   ├── A
│   │   ├── a_common.yaml  # common config items for a1 and a2
│   │   ├── a1.yaml
│   │   └── a2.yaml
│   └── B
│       ├── b_common.yaml  # common config items for b1 and b2
│       ├── b1.yaml
│       └── b2.yaml
└── config.yaml

1 Answers1

0

You can use a defaults list in the a1/a2/b1/b2 files:

# A/a1.yaml
defaults:
  - a_common

...  # a1 contents

References:

Jasha
  • 5,507
  • 2
  • 33
  • 44