manifest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingRequired indicates a required field or value is missing.
	ErrMissingRequired = errors.New("missing required field")
	// ErrInvalidValue indicates a field has an invalid value.
	ErrInvalidValue = errors.New("invalid value")
)

Functions

func Render

func Render(path string) (string, error)

Render reads the manifest file at the provided path (or discovers it like Load) and returns the YAML content with ${VAR} placeholders interpolated from the current environment. Missing variables are replaced with empty strings and a warning is emitted to stderr.

func RenderWithWarnings

func RenderWithWarnings(path string) (string, []string, error)

RenderWithWarnings reads the manifest file and returns interpolated YAML and the list of missing env var names.

func RenderWithWarningsAndPath added in v0.3.0

func RenderWithWarningsAndPath(path string) (string, string, []string, error)

RenderWithWarningsAndPath reads the manifest file and returns interpolated YAML, the resolved file path, and the list of missing env var names.

Types

type Config

type Config struct {
	Docker      DockerConfig                    `yaml:"docker"`
	Sops        *SopsConfig                     `yaml:"sops"`
	Secrets     *Secrets                        `yaml:"secrets"`
	Environment *Environment                    `yaml:"environment"`
	Stacks      map[string]Stack                `yaml:"stacks" validate:"dive"`
	Networks    map[string]NetworkSpec          `yaml:"networks"`
	Volumes     map[string]TopLevelResourceSpec `yaml:"volumes"`
	Filesets    map[string]FilesetSpec          `yaml:"filesets"`
	BaseDir     string                          `yaml:"-"`
}

Config is the root desired-state structure parsed from YAML.

func Load

func Load(path string) (Config, error)

Load reads and validates configuration from the provided path. When path is empty, it searches for manifest files in this order in the current working directory: dockform.yml, dockform.yaml, Dockform.yml, Dockform.yaml

func LoadWithWarnings

func LoadWithWarnings(path string) (Config, []string, error)

LoadWithWarnings reads and validates configuration and returns missing env var names instead of printing.

type DockerConfig

type DockerConfig struct {
	Context    string `yaml:"context"`
	Identifier string `yaml:"identifier"`
}

type Environment

type Environment struct {
	Files  []string `yaml:"files"`
	Inline []string `yaml:"inline"`
}

Environment holds environment file references

type FilesetSpec

type FilesetSpec struct {
	Source          string         `yaml:"source"`
	TargetVolume    string         `yaml:"target_volume"`
	TargetPath      string         `yaml:"target_path"`
	RestartServices RestartTargets `yaml:"restart_services"`
	ApplyMode       string         `yaml:"apply_mode"`
	Exclude         []string       `yaml:"exclude"`
	Ownership       *Ownership     `yaml:"ownership"`
	SourceAbs       string         `yaml:"-"`
}

FilesetSpec defines a local directory to sync into a docker volume at a target path.

type NetworkSpec added in v0.3.0

type NetworkSpec struct {
	Driver       string            `yaml:"driver"`
	Options      map[string]string `yaml:"options"`
	Internal     bool              `yaml:"internal"`
	Attachable   bool              `yaml:"attachable"`
	IPv6         bool              `yaml:"ipv6"`
	Subnet       string            `yaml:"subnet"`
	Gateway      string            `yaml:"gateway"`
	IPRange      string            `yaml:"ip_range"`
	AuxAddresses map[string]string `yaml:"aux_addresses"`
}

NetworkSpec allows configuring docker network driver and options.

type Ownership added in v0.6.0

type Ownership struct {
	User             string `yaml:"user"`              // numeric UID string preferred; allow names
	Group            string `yaml:"group"`             // numeric GID string preferred; allow names
	FileMode         string `yaml:"file_mode"`         // octal string "0644" or "644"
	DirMode          string `yaml:"dir_mode"`          // octal string "0755" or "755"
	PreserveExisting bool   `yaml:"preserve_existing"` // if true, only apply to new/updated paths
}

Ownership defines optional ownership and permission settings for fileset files.

type Project

type Project struct {
	Name string `yaml:"name"`
}

type RestartTargets added in v0.4.0

type RestartTargets struct {
	Attached bool
	Services []string
}

RestartTargets represents either an explicit list of services to restart, or the sentinel value "attached" which means: discover services that mount the fileset's target_volume.

func (*RestartTargets) UnmarshalYAML added in v0.4.0

func (r *RestartTargets) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML supports either a string (must be "attached") or a list of strings. If omitted or null, it results in no restarts.

type Secrets

type Secrets struct {
	Sops []string `yaml:"sops"`
}

Secrets holds secret sources

type SopsAgeConfig

type SopsAgeConfig struct {
	KeyFile    string   `yaml:"key_file"`
	Recipients []string `yaml:"recipients"`
}

type SopsConfig

type SopsConfig struct {
	Age *SopsAgeConfig `yaml:"age"`
	// Recipients is deprecated; kept for migration error messaging
	Recipients []string       `yaml:"recipients"`
	Pgp        *SopsPgpConfig `yaml:"pgp"`
}

SopsConfig configures SOPS provider(s)

type SopsPgpConfig added in v0.5.0

type SopsPgpConfig struct {
	KeyringDir   string   `yaml:"keyring_dir"`
	UseAgent     bool     `yaml:"use_agent"`
	PinentryMode string   `yaml:"pinentry_mode"`
	Recipients   []string `yaml:"recipients"`
	Passphrase   string   `yaml:"passphrase"`
}

SopsPgpConfig configures PGP (GnuPG) backend for SOPS

type Stack added in v0.6.0

type Stack struct {
	Root        string       `yaml:"root" validate:"required"`
	Files       []string     `yaml:"files"`
	Profiles    []string     `yaml:"profiles"`
	EnvFile     []string     `yaml:"env-file"`
	Environment *Environment `yaml:"environment"`
	Secrets     *Secrets     `yaml:"secrets"`
	Project     *Project     `yaml:"project"`
	EnvInline   []string     `yaml:"-"`
	SopsSecrets []string     `yaml:"-"`
}

type TopLevelResourceSpec

type TopLevelResourceSpec struct{}

TopLevelResourceSpec mirrors YAML for volumes.

Jump to

Keyboard shortcuts

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