Documentation
¶
Overview ¶
Package config reads plugin declarations and resolves locally built packages without executing code.
Index ¶
- Constants
- func CheckTransaction(ctx context.Context, project string) error
- func DeleteKey(content []byte, path []string) ([]byte, error)
- func DisplayPath(path string) string
- func EffectiveRegistries(plugins *schema.PluginsConfig) map[string]schema.PluginRegistry
- func IsLocal(declaration *schema.PluginPackage) bool
- func Mutate(ctx context.Context, project string, prepare func() ([]Change, error)) error
- func PackageTimeout(entry schema.PluginPackage) (time.Duration, error)
- func Quarantine(path string, now time.Time) (string, error)
- func RegistryHost(registry *schema.PluginRegistry) (string, error)
- func RegistrySources(registry *schema.PluginRegistry) []string
- func ResolveLocalPath(project, path string) (string, error)
- func SetFields(content []byte, path []string, fields []Field) ([]byte, error)
- func Validate(plugins *schema.PluginsConfig) error
- type Change
- type Field
- type Selection
- type Selections
Constants ¶
const ( DefaultRegistryAlias = "cloudposse" DefaultCatalog = "oci://ghcr.io/cloudposse/atmos/plugins/catalog:stable" )
const QuarantineSuffix = ".corrupt-"
QuarantineSuffix marks a file or directory moved aside because it failed verification.
Variables ¶
This section is empty.
Functions ¶
func CheckTransaction ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.