config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config handles loading and validating the stackup.yml configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Service string `yaml:"service"`
	Run     string `yaml:"run"`
}

Command defines a named command that runs inside a service container.

type Config

type Config struct {
	Version  string             `yaml:"version"`
	Env      EnvConfig          `yaml:"env"`
	Services map[string]Service `yaml:"services"`
	Commands map[string]Command `yaml:"commands"`
	Profiles map[string]Profile `yaml:"profiles"`
}

Config represents the top-level stackup.yml structure.

func Load

func Load(path string) (*Config, error)

Load reads and validates a stackup.yml file at the given path.

func LoadOrEmpty

func LoadOrEmpty(path string) *Config

LoadOrEmpty returns an empty Config when the file does not exist. Allows projects that haven't added stackup.yml yet to still use the tool.

func (*Config) ProfileServices

func (c *Config) ProfileServices(name string) ([]string, error)

ProfileServices returns the service names for a given profile. Returns an error if the profile is not defined.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the config for structural correctness.

type EnvConfig

type EnvConfig struct {
	Schema map[string]EnvVar `yaml:"schema"`
}

EnvConfig holds the environment variable schema definitions.

type EnvVar

type EnvVar struct {
	Type     string `yaml:"type"`
	Required bool   `yaml:"required"`
	Default  string `yaml:"default"`
}

EnvVar describes a single environment variable's constraints.

type HealthCheck

type HealthCheck struct {
	Type     string `yaml:"type"`
	URL      string `yaml:"url"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Pattern  string `yaml:"pattern"`
	Timeout  string `yaml:"timeout"`
	Interval string `yaml:"interval"`
}

HealthCheck defines how to verify a service is ready.

type HookAction

type HookAction struct {
	Name    string `yaml:"name"`
	Service string `yaml:"service"`
	Run     string `yaml:"run"`
}

HookAction describes a single hook command to execute inside a container.

type Hooks

type Hooks struct {
	AfterStart []HookAction `yaml:"after_start"`
}

Hooks contains lifecycle hook definitions for a service.

type Profile

type Profile struct {
	Services []string `yaml:"services"`
}

Profile defines a named subset of services to start.

type Service

type Service struct {
	Health *HealthCheck `yaml:"health"`
	Hooks  *Hooks       `yaml:"hooks"`
}

Service defines the health check and lifecycle hooks for a compose service.

Jump to

Keyboard shortcuts

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