config

package
v1.234.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package config reads plugin declarations and resolves locally built packages without executing code.

Index

Constants

View Source
const (
	DefaultRegistryAlias = "cloudposse"
	DefaultCatalog       = "oci://ghcr.io/cloudposse/atmos/plugins/catalog:stable"
)
View Source
const QuarantineSuffix = ".corrupt-"

QuarantineSuffix marks a file or directory moved aside because it failed verification.

Variables

This section is empty.

Functions

func CheckTransaction

func CheckTransaction(ctx context.Context, project string) error

CheckTransaction prevents ordinary commands from observing a partial commit. The error names the journal and says exactly what resolves it, since only some journals are repaired by `atmos plugin install`. Active mutations are awaited using ctx before deciding whether a journal records an interrupted commit.

func DeleteKey

func DeleteKey(content []byte, path []string) ([]byte, error)

DeleteKey removes the last element of path and its head comment. Deleting a missing key is a no-op. An emptied parent mapping is kept as an empty flow mapping so the document stays valid.

func DisplayPath

func DisplayPath(path string) string

DisplayPath renders a directory for a status message: relative to the current directory when it lies below it, absolute otherwise, so a path is never ambiguous.

func EffectiveRegistries

func EffectiveRegistries(plugins *schema.PluginsConfig) map[string]schema.PluginRegistry

EffectiveRegistries returns isolated discovery defaults and explicit overrides. An explicit alias replaces the whole built-in entry, including its catalog.

func IsLocal

func IsLocal(declaration *schema.PluginPackage) bool

IsLocal reports whether an enabled declaration selects a local build. A disabled package is never local, so it never runs. The path wins over source and version, which stay declared but unused.

func Mutate

func Mutate(ctx context.Context, project string, prepare func() ([]Change, error)) error

Mutate serializes plugin state changes and recovers interrupted commits before preparing another. The callback stages complete file bytes without writing them.

func PackageTimeout

func PackageTimeout(entry schema.PluginPackage) (time.Duration, error)

PackageTimeout parses the optional per-call deadline; zero means none.

func Quarantine

func Quarantine(path string, now time.Time) (string, error)

Quarantine renames a damaged file or directory to `<path>.corrupt-<unixts>` next to it. The damaged bytes stay available for inspection and are never deleted. A numeric suffix disambiguates repeated quarantines within the same second.

func RegistryHost

func RegistryHost(registry *schema.PluginRegistry) (string, error)

RegistryHost validates discovery sources and resolves their single authentication host. A host-only registry configures authentication without enabling discovery.

func RegistrySources

func RegistrySources(registry *schema.PluginRegistry) []string

RegistrySources returns configured catalog and repository sources in declaration order.

func ResolveLocalPath

func ResolveLocalPath(project, path string) (string, error)

ResolveLocalPath returns the absolute directory of a package path. A relative path is relative to the project directory, the same base as the release lock.

func SetFields

func SetFields(content []byte, path []string, fields []Field) ([]byte, error)

SetFields assigns keys inside the mapping at path, creating missing mappings in block style. It splices bytes rather than re-encoding the document, so comments, blank lines, quoting, indentation and inline-comment spacing outside the touched lines are left byte-identical. Layouts it cannot edit safely (flow collections on the path, anchors, multiple documents) use the general YAML editor instead.

func Validate

func Validate(plugins *schema.PluginsConfig) error

Validate rejects reserved configuration instead of silently ignoring policy.

Types

type Change

type Change struct {
	Name   string `json:"name"`
	Before []byte `json:"before"`
	After  []byte `json:"after"`
	Mode   uint32 `json:"mode,omitempty"`
}

Change is one root-level configuration or lock replacement. Before is nil only when the file did not exist. A journal preserves both versions on failure.

type Field

type Field struct {
	Key   string
	Value string
	Items []string
}

Field is one key assigned inside a mapping. A nil Items means Value is a scalar; otherwise the key holds a block sequence of scalars.

type Selection

type Selection struct {
	// Path is the absolute package directory that holds plugin.yaml.
	Path string
	// Executable is the executable below Path. It is empty for a local build, whose executable is
	// read from the current manifest at activation so a rebuild is picked up without reinstalling.
	Executable string
	// Local marks a package selected by plugins.packages.<alias>.path, which bypasses the lock, the
	// cache and signature evidence.
	Local bool
}

Selection locates the code one package alias runs: a verified cached release or a local build.

type Selections

type Selections struct {
	Packages map[string]Selection
}

Selections is the set of packages one command activates.

func LocalSelections

func LocalSelections(project string, packages map[string]schema.PluginPackage) (*Selections, error)

LocalSelections resolves every enabled package that declares a path.

func NewSelections

func NewSelections() *Selections

NewSelections returns an empty selection.

Jump to

Keyboard shortcuts

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