To better support the use-case of dynamically generating configs from other configs and variables, the following changes are made:
Added paths to file config source. Either the existing path or paths is required.
All the files listed in paths are merged using mergo with mergo.WithOverride and mergo.WithOverwriteWithEmptyValue
config source's paths and path can now refer to vars. variant internally builds a DAG of vars, confs, and secs to make it possible.
Added function block to define user-functions, with support for recursive call. Note that user-functions are visible within a variant command that defines it.
This means two things:
You can't import user-functions
User-functions defined in the parent variant command are not visible to imported variant commands.
Added new example for config-depends-on-var use-case at examples/advanced/dynamic-config-inheritance
Added new example for importing variant command with local user-function at examples/advanced/userfunc-local-scope
To better support the use-case of dynamically generating configs from other configs and variables, the following changes are made:
paths
tofile
config source. Either the existingpath
orpaths
is required.paths
are merged usingmergo
withmergo.WithOverride
andmergo.WithOverwriteWithEmptyValue
paths
andpath
can now refer tovar
s.variant
internally builds a DAG ofvar
s,conf
s, andsec
s to make it possible.function
block to define user-functions, with support for recursive call. Note that user-functions are visible within a variant command that defines it.import
user-functionsexamples/advanced/dynamic-config-inheritance
examples/advanced/userfunc-local-scope
Resolves #42