config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(cfg BuildConfig) error

Validate checks that a BuildConfig is semantically valid.

Types

type BuildConfig

type BuildConfig struct {
	// Version must be 1.
	Version int `yaml:"version"`

	// OutputPath is the destination path for the merged output.
	OutputPath string `yaml:"output_path"`

	// Write controls whether output is written to OutputPath (true) or stdout (false).
	// This field is not present in the YAML schema; it is set by the --write CLI flag.
	Write bool `yaml:"-"`

	// Overlays is the ordered list of repositories and files to merge.
	Overlays []Overlay `yaml:"overlays"`
}

BuildConfig is the canonical input type for Gantry.Build. It is produced either from a YAML file (LoadYAMLConfig) or from CLI flags (CLIFlagsToConfig).

func CLIFlagsToConfig

func CLIFlagsToConfig(f CLIFlags) (BuildConfig, error)

CLIFlagsToConfig builds a single-overlay BuildConfig from parsed CLI flags.

func LoadYAMLConfig

func LoadYAMLConfig(path string) (BuildConfig, error)

LoadYAMLConfig reads a YAML config file, expands ${ENV_VAR} references in all string fields, and validates the result.

type CLIFlags

type CLIFlags struct {
	Repo           string
	Ref            string
	Commit         string
	Files          []string
	OutputPath     string
	Write          bool
	Token          string
	Username       string
	Password       string
	SSHKeyPath     string
	SSHKeyPassword string
}

CLIFlags holds all values parsed from the `gantry build` flags for single-repo use.

type Overlay

type Overlay struct {
	// Repo is a remote URL or local path. Remote URLs support https://, http://,
	// ssh://, git://, and git@ (SCP-style). Local paths may be absolute,
	// relative (./  ../), or file:// URIs.
	// Append //subdir to set a subdirectory (e.g. https://github.com/org/repo//configs).
	Repo string `yaml:"repo"`

	// Ref is the branch or tag reference (e.g. refs/heads/main).
	// Mutually exclusive with Commit.
	Ref string `yaml:"ref"`

	// Commit is an exact commit SHA to check out (7–40 hex characters).
	// Mutually exclusive with Ref.
	Commit string `yaml:"commit"`

	// Subdirectory is prepended to all file paths when reading from the repo.
	// For remote URLs the //subdir URL syntax may be used instead.
	Subdirectory string `yaml:"subdirectory"`

	// Files is the ordered list of file paths to extract and merge.
	Files []string `yaml:"files"`

	// Auth holds optional credentials for cloning the repository.
	Auth OverlayAuth `yaml:"auth"`
}

Overlay describes a single source repository and the ordered list of files to extract from it for merging.

type OverlayAuth

type OverlayAuth struct {
	Token          string `yaml:"token"`
	Username       string `yaml:"username"`
	Password       string `yaml:"password"`
	SSHKeyPath     string `yaml:"ssh_key_path"`
	SSHKeyPassword string `yaml:"ssh_key_password"`
}

OverlayAuth holds authentication credentials for a single overlay's repository. All string fields support ${ENV_VAR} interpolation.

Jump to

Keyboard shortcuts

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