Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsApplicationConfig added in v0.1.6

func IsApplicationConfig(data []byte) bool

IsApplicationConfig returns true if the YAML data contains an application-level config (i.e., has an "application" key with a "workflows" section).

func ResolvePathInConfig

func ResolvePathInConfig(cfg map[string]any, path string) string

ResolvePathInConfig resolves a path relative to the _config_dir stored in a module's config map. If the path is already absolute or no _config_dir is present, the original path is returned.

Types

type ApplicationConfig added in v0.1.6

type ApplicationConfig struct {
	// Application holds the application-level metadata and workflow references.
	Application ApplicationInfo `json:"application" yaml:"application"`
	// ConfigDir is the directory of the application config file, used for resolving relative paths.
	ConfigDir string `json:"-" yaml:"-"`
}

ApplicationConfig is the top-level config for a multi-workflow application. It references multiple workflow config files that share a module registry.

func LoadApplicationConfig added in v0.1.6

func LoadApplicationConfig(filepath string) (*ApplicationConfig, error)

LoadApplicationConfig loads an application config from a YAML file.

type ApplicationInfo added in v0.1.6

type ApplicationInfo struct {
	// Name is the application name.
	Name string `json:"name" yaml:"name"`
	// Workflows lists the workflow config files that make up this application.
	Workflows []WorkflowRef `json:"workflows" yaml:"workflows"`
}

ApplicationInfo holds top-level metadata about a multi-workflow application.

type ModuleConfig

type ModuleConfig struct {
	Name      string            `json:"name" yaml:"name"`
	Type      string            `json:"type" yaml:"type"`
	Config    map[string]any    `json:"config,omitempty" yaml:"config,omitempty"`
	DependsOn []string          `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"`
	Branches  map[string]string `json:"branches,omitempty" yaml:"branches,omitempty"`
}

ModuleConfig represents a single module configuration

type PipelineConfig

type PipelineConfig struct {
	Trigger      PipelineTriggerConfig `json:"trigger" yaml:"trigger"`
	Steps        []PipelineStepConfig  `json:"steps" yaml:"steps"`
	OnError      string                `json:"on_error,omitempty" yaml:"on_error,omitempty"`
	Timeout      string                `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Compensation []PipelineStepConfig  `json:"compensation,omitempty" yaml:"compensation,omitempty"`
}

PipelineConfig represents a single composable pipeline definition.

type PipelineStepConfig

type PipelineStepConfig struct {
	Name    string         `json:"name" yaml:"name"`
	Type    string         `json:"type" yaml:"type"`
	Config  map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
	OnError string         `json:"on_error,omitempty" yaml:"on_error,omitempty"`
	Timeout string         `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}

PipelineStepConfig defines a single step in a pipeline.

type PipelineTriggerConfig

type PipelineTriggerConfig struct {
	Type   string         `json:"type" yaml:"type"`
	Config map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

PipelineTriggerConfig defines what starts a pipeline.

type PluginRequirement

type PluginRequirement struct {
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

PluginRequirement specifies a required plugin with optional version constraint.

type RequiresConfig

type RequiresConfig struct {
	Capabilities []string            `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
	Plugins      []PluginRequirement `json:"plugins,omitempty" yaml:"plugins,omitempty"`
}

RequiresConfig declares what capabilities and plugins a workflow needs.

type WorkflowConfig

type WorkflowConfig struct {
	Modules   []ModuleConfig  `json:"modules" yaml:"modules"`
	Workflows map[string]any  `json:"workflows" yaml:"workflows"`
	Triggers  map[string]any  `json:"triggers" yaml:"triggers"`
	Pipelines map[string]any  `json:"pipelines,omitempty" yaml:"pipelines,omitempty"`
	Platform  map[string]any  `json:"platform,omitempty" yaml:"platform,omitempty"`
	Requires  *RequiresConfig `json:"requires,omitempty" yaml:"requires,omitempty"`
	ConfigDir string          `json:"-" yaml:"-"` // directory containing the config file, used for relative path resolution
}

WorkflowConfig represents the overall configuration for the workflow engine

func LoadFromFile

func LoadFromFile(filepath string) (*WorkflowConfig, error)

LoadFromFile loads a workflow configuration from a YAML file

func LoadFromString

func LoadFromString(yamlContent string) (*WorkflowConfig, error)

LoadFromString loads a workflow configuration from a YAML string.

func MergeApplicationConfig added in v0.1.6

func MergeApplicationConfig(appCfg *ApplicationConfig) (*WorkflowConfig, error)

MergeApplicationConfig loads all workflow config files referenced by an ApplicationConfig and merges them into a single WorkflowConfig. This is useful for callers that need a single combined config (e.g., the server's admin merge step) before passing it to the engine.

Module name conflicts across files are reported as errors.

func NewEmptyWorkflowConfig

func NewEmptyWorkflowConfig() *WorkflowConfig

NewEmptyWorkflowConfig creates a new empty workflow configuration

func (*WorkflowConfig) ResolveRelativePath

func (c *WorkflowConfig) ResolveRelativePath(path string) string

ResolveRelativePath resolves a path relative to the config file's directory. If the path is absolute, it is returned as-is.

type WorkflowRef added in v0.1.6

type WorkflowRef struct {
	// File is the path to the workflow YAML config file (relative to the application config).
	File string `json:"file" yaml:"file"`
	// Name is an optional override for the workflow's name within the application namespace.
	// If empty, the filename stem (without extension) is used.
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

WorkflowRef is a reference to a workflow config file within an application config.

Jump to

Keyboard shortcuts

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