Documentation
¶
Overview ¶
Package envparams resolves the BuildParams document that lets a command build its environment without a domain directory. It is shared with the mcms CLI.
Index ¶
Constants ¶
const ( // FlagName carries a BuildParams YAML document. FlagName = "env-build-params" // EnvVar carries the same document when the flag is not set. Prefer it, as // the document holds secrets that should not be on a command line. EnvVar = "MCMS_ENV_BUILD_PARAMS" // DomainFlagName and EnvFlagName are the flags the document replaces. DomainFlagName = "domain" EnvFlagName = "environment" )
Variables ¶
var ErrEmptyDocument = errors.New("document is empty")
ErrEmptyDocument reports the build params flag passed empty.
var ErrFlagNotAllowed = errors.New("cannot be combined with build params")
ErrFlagNotAllowed reports a flag combined with build params that set the same thing.
Functions ¶
func Parse ¶
func Parse(data []byte) (cldfenv.BuildParams, error)
Parse decodes a BuildParams YAML document, rejecting unknown keys.
func RegisterFlag ¶
RegisterFlag adds the build params flag to flags.
func Resolve ¶
Resolve returns the build params to use, or nil when none were supplied and the command should load from disk.
The flag wins over EnvVar, and an explicitly empty flag is an error rather than a fall back. The document owns the domain and environment, so passing them as flags too is rejected. They are written back to the flags so required flag validation passes.
Types ¶
This section is empty.