The package determines where the content of each input config is placed in the output config.
The default package of an input config is derived from its Config Group. e.g. The default package of
The default package can be overridden in the Defaults List or via a Package Directive at the top of the config file. Changing the package of a config can be useful when using a config from another library, or when using the same config group twice in the same app.
The priority for determining the final package for a config is as follows:
- The package specified in the Defaults List (relative to the package of the including config)
- The package specified in the Package Directive (absolute)
- The default package
We will use the following configs in the examples below:
The default package of config.yaml is the global package, of server/apache.yaml is server and of server/db/mysql.yaml is server.db.
By default, packages specified in the Defaults List are relative to the package of containing config. As a consequence, overriding a package relocates the entire subtree.
Note that content of server/apache.yaml is relocated to admin and the content of server/db/mysql.yaml to admin.backup.
We will use this example, replacing <@PACKAGE> to demonstrate different cases:
Without a package override, the resulting package is
With the @_here_ keyword, The resulting package is the same as the containing config (
- @_group_: _group_ is the absolute default package of the config (
- @_global_: The global package. Anything following _global_ is absolute.
e.g. @_global_.foo becomes
The @package directive changes the package of a config file. The package specified by a @package directive is always absolute.
To change the package to the global (empty) package, use the keyword
The following example adds the
server/db/mysql config in the packages
When overriding config groups with a non-default package, the package must be used: