Documentation
¶
Overview ¶
Package config composes a project's configuration from its layers and remembers where each value came from. The order, lowest first: plugin and pack defaults, imports, includes, rig.yaml, then .rig/local.yaml; afterwards `defaults:` and `templates:`/`extends` fill each entry. A layer above wins key by key, and `key: null` drops what the layers below say.
Index ¶
- func Key(importer, version string, watch ...string) (string, error)
- func Value(n *yaml.Node, key string) *yaml.Node
- type Cache
- type Doc
- func (d *Doc) ApplyTemplates(file string) error
- func (d *Doc) Bytes() ([]byte, error)
- func (d *Doc) Explain(path string) []Origin
- func (d *Doc) Finish()
- func (d *Doc) Get(path string) *yaml.Node
- func (d *Doc) Origin(path string) (Origin, bool)
- func (d *Doc) Over(o *Doc)
- func (d *Doc) Stamp(n *yaml.Node, file, layer string)
- func (d *Doc) Under(o *Doc)
- type Options
- type Origin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct{ Dir string }
Cache keeps importers' fragments in dir, keyed by what they read, so a warm load parses no foreign files.
type Doc ¶
Doc is a configuration as a YAML tree, with each node's origin and, per path, every layer that set it.
func Compose ¶
Compose builds a project's configuration from rig.yaml (raw, at file) and every layer around it.
func (*Doc) ApplyTemplates ¶ added in v0.35.1
ApplyTemplates is what Compose does last unless NoTemplates.
func (*Doc) Finish ¶
func (d *Doc) Finish()
Finish drops the tombstones: every key whose null overrode a lower layer.
type Options ¶
type Options struct {
// Defaults are plugin and pack fragments, lowest first.
Defaults []*Doc
// Import runs one `imports:` entry and returns its fragment.
Import func(kind, path string, project *yaml.Node) (*Doc, error)
// NoLocal skips .rig/local.yaml.
NoLocal bool
// NoTemplates leaves `defaults:` and `extends` to ApplyTemplates, for a first pass that only
// finds the plugins whose fragments may hold the templates.
NoTemplates bool
}
Options feed Compose what lives outside rig.yaml.