config

package
v0.1.18-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

overlay.go implements local config.yaml overlay loading and deterministic merge for the Hydra envs/in/out/home contract.

The config.yaml lives at $PLOY_CONFIG_HOME/config.yaml and supports:

defaults:
  server:   {envs, home}
  node:     {envs, home}
  job:
    pre_gate:  {envs, in, out, home}
    post_gate: {envs, in, out, home}
    mig:       {envs, in, out, home}

Merge precedence (lowest → highest): server defaults < local config.yaml < spec. Per-field merge rules:

  • envs: key-based override by precedence
  • in/out/home: merge by destination; higher precedence replaces same destination

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeJobConfigIntoSpec

func MergeJobConfigIntoSpec(block map[string]any, cfg *JobConfig)

MergeJobConfigIntoSpec applies a JobConfig overlay onto a spec container block (map[string]any) using deterministic merge rules:

  • envs: key-based override (overlay wins for same key, spec wins overall)
  • in/out/home: merge by destination; spec entry replaces overlay for same dst

This implements the "local config < spec" precedence for a single block.

func SortedEnvKeys

func SortedEnvKeys(m map[string]string) []string

SortedEnvKeys returns sorted keys from an envs map for deterministic output.

Types

type ComponentConfig

type ComponentConfig struct {
	Envs map[string]string `yaml:"envs,omitempty" json:"envs,omitempty"`
	Home []string          `yaml:"home,omitempty" json:"home,omitempty"`
}

ComponentConfig holds envs/home for server and node component sections.

type Defaults

type Defaults struct {
	Server *ComponentConfig `yaml:"server,omitempty" json:"server,omitempty"`
	Node   *ComponentConfig `yaml:"node,omitempty" json:"node,omitempty"`
	Job    *JobTargets      `yaml:"job,omitempty" json:"job,omitempty"`
}

Defaults is the top-level defaults section of config.yaml.

type JobConfig

type JobConfig struct {
	Envs map[string]string `yaml:"envs,omitempty" json:"envs,omitempty"`
	In   []string          `yaml:"in,omitempty" json:"in,omitempty"`
	Out  []string          `yaml:"out,omitempty" json:"out,omitempty"`
	Home []string          `yaml:"home,omitempty" json:"home,omitempty"`
}

JobConfig holds the full Hydra field set for job container sections.

type JobTargets

type JobTargets struct {
	PreGate  *JobConfig `yaml:"pre_gate,omitempty" json:"pre_gate,omitempty"`
	PostGate *JobConfig `yaml:"post_gate,omitempty" json:"post_gate,omitempty"`
	Mig      *JobConfig `yaml:"mig,omitempty" json:"mig,omitempty"`
}

JobTargets groups the per-phase job config sections.

type Overlay

type Overlay struct {
	Defaults *Defaults `yaml:"defaults,omitempty" json:"defaults,omitempty"`
}

Overlay represents a parsed $PLOY_CONFIG_HOME/config.yaml.

func LoadOverlay

func LoadOverlay() (Overlay, error)

LoadOverlay reads and parses $PLOY_CONFIG_HOME/config.yaml. Returns a zero Overlay (not an error) when the file does not exist.

func LoadOverlayFrom

func LoadOverlayFrom(path string) (Overlay, error)

LoadOverlayFrom reads and parses a config.yaml at the given path. Returns a zero Overlay (not an error) when the file does not exist.

func (*Overlay) JobSection

func (o *Overlay) JobSection(jobType string) *JobConfig

JobSection returns the JobConfig for the given job type string. Known types: "pre_gate", "post_gate", "mig". Returns nil when the overlay has no config for the given type.

Jump to

Keyboard shortcuts

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