Documentation ¶
Overview ¶
Package vars implements a registry of ${var} placeholders.
They can be used in config validation rule patterns and config set names and paths in place of a not-yet-known values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VarSet ¶
type VarSet struct {
// contains filtered or unexported fields
}
VarSet holds a registry ${var} -> callback that extracts it from a context.
It is used by the config client to render config validation patterns like "services/${appid}". By using placeholder vars it is possible to register validation rules during process startup time before values of all vars are actually known.
var Vars VarSet
Vars is the default set of placeholder vars used by the process.
Individual packages may register vars here during init() time.
func (*VarSet) Register ¶
Register registers a variable that can be used in templates as `${name}`.
Such placeholder variable is rendered into an actual value via the given callback in RenderTemplate.
The primary use case for this mechanism is to allow to register config validation rule patterns that depend on not-yet known values during init() time.
Panics if such variable is already registered.