envparams

package
v0.126.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 7 Imported by: 0

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

View Source
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

View Source
var ErrEmptyDocument = errors.New("document is empty")

ErrEmptyDocument reports the build params flag passed empty.

View Source
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

func RegisterFlag(flags *pflag.FlagSet)

RegisterFlag adds the build params flag to flags.

func Resolve

func Resolve(flags *pflag.FlagSet, getenv func(string) string) (*cldfenv.BuildParams, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL