config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrossValidate added in v0.7.0

func CrossValidate(cfg *WorkflowConfig) []string

CrossValidate performs cross-section warnings between services, networking, and mesh. It returns warnings (non-fatal) as a string slice.

func HasNonModuleChanges added in v0.2.20

func HasNonModuleChanges(old, new *WorkflowConfig) bool

HasNonModuleChanges returns true if workflows, triggers, pipelines, platform config, or requirements changed between old and new (requiring full reload).

func HashConfig added in v0.2.20

func HashConfig(cfg *WorkflowConfig) (string, error)

HashConfig returns the SHA256 hex digest of the YAML-serialized config.

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 MergeConfigs added in v0.1.7

func MergeConfigs(primary, fragment *WorkflowConfig)

MergeConfigs merges a config fragment into the primary config. Modules are appended. Workflows and triggers are merged without overwriting existing keys.

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.

func ValidateMeshRoutes added in v0.7.0

func ValidateMeshRoutes(mesh *MeshConfig, services map[string]*ServiceConfig) []string

ValidateMeshRoutes checks mesh.routes references against known service names.

func ValidateNetworking added in v0.7.0

func ValidateNetworking(networking *NetworkingConfig, services map[string]*ServiceConfig) error

ValidateNetworking checks the networking: section for correctness. It validates ingress references against services and their exposed ports.

func ValidateSecurity added in v0.7.0

func ValidateSecurity(security *SecurityConfig) error

ValidateSecurity checks the security: section.

func ValidateServices added in v0.7.0

func ValidateServices(services map[string]*ServiceConfig) error

ValidateServices checks the services: section for correctness.

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 CIAssetTarget added in v0.6.0

type CIAssetTarget struct {
	Name  string `json:"name" yaml:"name"`
	Build string `json:"build" yaml:"build"`
	Path  string `json:"path" yaml:"path"`
}

CIAssetTarget is a non-binary build artifact (e.g., frontend bundle).

type CIBinaryTarget added in v0.6.0

type CIBinaryTarget struct {
	Name    string            `json:"name" yaml:"name"`
	Path    string            `json:"path" yaml:"path"`
	OS      []string          `json:"os,omitempty" yaml:"os,omitempty"`
	Arch    []string          `json:"arch,omitempty" yaml:"arch,omitempty"`
	LDFlags string            `json:"ldflags,omitempty" yaml:"ldflags,omitempty"`
	Env     map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
}

CIBinaryTarget is a Go binary to compile.

type CIBuildConfig added in v0.6.0

type CIBuildConfig struct {
	Binaries   []CIBinaryTarget    `json:"binaries,omitempty" yaml:"binaries,omitempty"`
	Containers []CIContainerTarget `json:"containers,omitempty" yaml:"containers,omitempty"`
	Assets     []CIAssetTarget     `json:"assets,omitempty" yaml:"assets,omitempty"`
}

CIBuildConfig defines what artifacts the build phase produces.

type CIConfig added in v0.6.0

type CIConfig struct {
	Build  *CIBuildConfig  `json:"build,omitempty" yaml:"build,omitempty"`
	Test   *CITestConfig   `json:"test,omitempty" yaml:"test,omitempty"`
	Deploy *CIDeployConfig `json:"deploy,omitempty" yaml:"deploy,omitempty"`
	Infra  *CIInfraConfig  `json:"infra,omitempty" yaml:"infra,omitempty"`
}

CIConfig holds the ci: section of a workflow config — build, test, and deploy lifecycle.

func (*CIConfig) Validate added in v0.6.0

func (c *CIConfig) Validate() error

Validate checks the CIConfig for required fields.

type CIContainerTarget added in v0.6.0

type CIContainerTarget struct {
	Name       string `json:"name" yaml:"name"`
	Dockerfile string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"`
	Context    string `json:"context,omitempty" yaml:"context,omitempty"`
	Registry   string `json:"registry,omitempty" yaml:"registry,omitempty"`
	Tag        string `json:"tag,omitempty" yaml:"tag,omitempty"`
}

CIContainerTarget is a container image to build.

type CIDeployConfig added in v0.6.0

type CIDeployConfig struct {
	Environments map[string]*CIDeployEnvironment `json:"environments,omitempty" yaml:"environments,omitempty"`
}

CIDeployConfig defines deployment environments.

type CIDeployEnvironment added in v0.6.0

type CIDeployEnvironment struct {
	Provider        string         `json:"provider" yaml:"provider"`
	Cluster         string         `json:"cluster,omitempty" yaml:"cluster,omitempty"`
	Namespace       string         `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	Region          string         `json:"region,omitempty" yaml:"region,omitempty"`
	Strategy        string         `json:"strategy,omitempty" yaml:"strategy,omitempty"`
	RequireApproval bool           `json:"requireApproval,omitempty" yaml:"requireApproval,omitempty"`
	PreDeploy       []string       `json:"preDeploy,omitempty" yaml:"preDeploy,omitempty"`
	HealthCheck     *CIHealthCheck `json:"healthCheck,omitempty" yaml:"healthCheck,omitempty"`
}

CIDeployEnvironment is a single deployment target.

type CIHealthCheck added in v0.6.0

type CIHealthCheck struct {
	Path    string `json:"path" yaml:"path"`
	Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}

CIHealthCheck defines how to verify a deployment is healthy.

type CIInfraConfig added in v0.6.0

type CIInfraConfig struct {
	Provision    bool                  `json:"provision" yaml:"provision"`
	StateBackend string                `json:"stateBackend,omitempty" yaml:"stateBackend,omitempty"`
	Resources    []InfraResourceConfig `json:"resources,omitempty" yaml:"resources,omitempty"`
}

CIInfraConfig defines infrastructure provisioning for CI.

type CITestConfig added in v0.6.0

type CITestConfig struct {
	Unit        *CITestPhase `json:"unit,omitempty" yaml:"unit,omitempty"`
	Integration *CITestPhase `json:"integration,omitempty" yaml:"integration,omitempty"`
	E2E         *CITestPhase `json:"e2e,omitempty" yaml:"e2e,omitempty"`
}

CITestConfig defines test phases.

type CITestPhase added in v0.6.0

type CITestPhase struct {
	Command  string   `json:"command" yaml:"command"`
	Coverage bool     `json:"coverage,omitempty" yaml:"coverage,omitempty"`
	Needs    []string `json:"needs,omitempty" yaml:"needs,omitempty"`
}

CITestPhase is a single test phase.

type CloudflareTunnelConfig added in v0.6.0

type CloudflareTunnelConfig struct {
	TunnelName string `json:"tunnelName,omitempty" yaml:"tunnelName,omitempty"`
	Domain     string `json:"domain,omitempty" yaml:"domain,omitempty"`
}

CloudflareTunnelConfig for Cloudflare Tunnel exposure.

type CompositeSource added in v0.2.20

type CompositeSource struct {
	// contains filtered or unexported fields
}

CompositeSource layers multiple ConfigSources. Later sources override earlier ones. Module-level overrides are applied by name; map keys (workflows, triggers, pipelines, platform) from later sources replace or add to those from earlier ones.

func NewCompositeSource added in v0.2.20

func NewCompositeSource(sources ...ConfigSource) *CompositeSource

NewCompositeSource creates a CompositeSource from the given sources. Sources are applied in order: sources[0] is the base, each subsequent source overlays on top of the result.

func (*CompositeSource) Hash added in v0.2.20

func (s *CompositeSource) Hash(ctx context.Context) (string, error)

Hash loads the merged config and returns its hash.

func (*CompositeSource) Load added in v0.2.20

Load loads all sources and merges them into a single WorkflowConfig.

func (*CompositeSource) Name added in v0.2.20

func (s *CompositeSource) Name() string

Name returns a human-readable identifier for this source.

type ConfigChangeEvent added in v0.2.20

type ConfigChangeEvent struct {
	Source  string
	OldHash string
	NewHash string
	Config  *WorkflowConfig
	Time    time.Time
}

ConfigChangeEvent is emitted when a ConfigSource detects a change.

type ConfigReloader added in v0.2.20

type ConfigReloader struct {
	// contains filtered or unexported fields
}

ConfigReloader coordinates config change detection and engine reload decisions. It diffs old and new configs, performs partial per-module reconfiguration when possible, and falls back to a full reload when non-module sections change or modules are added/removed/non-reconfigurable.

func NewConfigReloader added in v0.2.20

func NewConfigReloader(
	initial *WorkflowConfig,
	fullReloadFn func(*WorkflowConfig) error,
	reconfigurer ModuleReconfigurer,
	logger *slog.Logger,
) (*ConfigReloader, error)

NewConfigReloader creates a ConfigReloader with the given initial config. fullReloadFn is called when a full engine restart is required. reconfigurer is optional; if nil, all module changes fall back to fullReloadFn.

func (*ConfigReloader) HandleChange added in v0.2.20

func (r *ConfigReloader) HandleChange(evt ConfigChangeEvent) error

HandleChange processes a config change event. It diffs the old and new configs, attempts per-module reconfiguration for module-only changes, and falls back to a full reload when necessary.

func (*ConfigReloader) SetReconfigurer added in v0.2.20

func (r *ConfigReloader) SetReconfigurer(reconfigurer ModuleReconfigurer)

SetReconfigurer updates the ModuleReconfigurer used for partial (per-module) reloads. This should be called after a successful full engine reload if the underlying engine (and its reconfigurer) has changed.

type ConfigSource added in v0.2.20

type ConfigSource interface {
	// Load retrieves the current configuration.
	Load(ctx context.Context) (*WorkflowConfig, error)

	// Hash returns a content-addressable hash of the current config.
	// Used for change detection without full deserialization.
	Hash(ctx context.Context) (string, error)

	// Name returns a human-readable identifier for this source.
	Name() string
}

ConfigSource provides configuration from an arbitrary backend. Implementations must be safe for concurrent use.

type ConfigWatcher added in v0.2.20

type ConfigWatcher struct {
	// contains filtered or unexported fields
}

ConfigWatcher monitors a config file for changes and invokes a callback. It watches the directory containing the file for atomic-save compatibility.

func NewConfigWatcher added in v0.2.20

func NewConfigWatcher(source *FileSource, onChange func(ConfigChangeEvent), opts ...WatcherOption) *ConfigWatcher

NewConfigWatcher creates a ConfigWatcher for the given FileSource. onChange is called with a ConfigChangeEvent whenever the config changes.

func (*ConfigWatcher) Start added in v0.2.20

func (w *ConfigWatcher) Start() error

Start begins watching the config file's directory for changes.

func (*ConfigWatcher) Stop added in v0.2.20

func (w *ConfigWatcher) Stop() error

Stop terminates the watcher and waits for the background goroutine to exit. It is safe to call Stop multiple times.

type DBConfigStore added in v0.2.20

type DBConfigStore interface {
	GetConfigDocument(ctx context.Context, key string) ([]byte, error)
	GetConfigDocumentHash(ctx context.Context, key string) (string, error)
	PutConfigDocument(ctx context.Context, key string, data []byte) error
}

DBConfigStore is the database interface needed by DatabaseSource.

type DNSConfig added in v0.7.0

type DNSConfig struct {
	Provider string      `json:"provider,omitempty" yaml:"provider,omitempty"`
	Zone     string      `json:"zone,omitempty" yaml:"zone,omitempty"`
	Records  []DNSRecord `json:"records,omitempty" yaml:"records,omitempty"`
}

DNSConfig defines DNS management.

type DNSRecord added in v0.7.0

type DNSRecord struct {
	Name   string `json:"name" yaml:"name"`
	Type   string `json:"type" yaml:"type"`
	Target string `json:"target" yaml:"target"`
}

DNSRecord is a single DNS record.

type DatabasePoller added in v0.2.20

type DatabasePoller struct {
	// contains filtered or unexported fields
}

DatabasePoller periodically checks a DatabaseSource for config changes.

func NewDatabasePoller added in v0.2.20

func NewDatabasePoller(source *DatabaseSource, interval time.Duration, onChange func(ConfigChangeEvent), logger *slog.Logger) *DatabasePoller

NewDatabasePoller creates a DatabasePoller that calls onChange whenever the config stored in source changes.

func (*DatabasePoller) Start added in v0.2.20

func (p *DatabasePoller) Start(ctx context.Context) error

Start fetches the initial hash and launches the background polling goroutine.

func (*DatabasePoller) Stop added in v0.2.20

func (p *DatabasePoller) Stop()

Stop signals the polling goroutine to exit and waits for it to finish. It is safe to call Stop multiple times.

type DatabaseSource added in v0.2.20

type DatabaseSource struct {
	// contains filtered or unexported fields
}

DatabaseSource loads config from a database with caching.

func NewDatabaseSource added in v0.2.20

func NewDatabaseSource(store DBConfigStore, opts ...DatabaseSourceOption) *DatabaseSource

NewDatabaseSource creates a DatabaseSource backed by the given store.

func (*DatabaseSource) Hash added in v0.2.20

func (s *DatabaseSource) Hash(ctx context.Context) (string, error)

Hash returns the SHA256 hex digest of the stored config bytes. It first tries the fast path of fetching the pre-computed hash from the database, and falls back to loading the full document if that fails. The fallback always fetches fresh data to ensure change detection is accurate.

func (*DatabaseSource) Load added in v0.2.20

Load retrieves the current configuration, returning a cached copy if still within the refresh interval.

func (*DatabaseSource) Name added in v0.2.20

func (s *DatabaseSource) Name() string

Name returns a human-readable identifier for this source.

type DatabaseSourceOption added in v0.2.20

type DatabaseSourceOption func(*DatabaseSource)

DatabaseSourceOption configures a DatabaseSource.

func WithConfigKey added in v0.2.20

func WithConfigKey(key string) DatabaseSourceOption

WithConfigKey sets the document key used to look up config in the database.

func WithRefreshInterval added in v0.2.20

func WithRefreshInterval(d time.Duration) DatabaseSourceOption

WithRefreshInterval sets the cache TTL for the DatabaseSource.

type EngineConfig added in v0.3.66

type EngineConfig struct {
	Validation *EngineValidationConfig `json:"validation,omitempty" yaml:"validation,omitempty"`
}

EngineConfig holds engine-level runtime settings.

type EngineValidationConfig added in v0.3.66

type EngineValidationConfig struct {
	// TemplateRefs controls template cross-reference validation at startup.
	// Allowed values: "off" (skip), "warn" (log warnings, default), "error" (fail on any validation issues).
	TemplateRefs string `json:"templateRefs,omitempty" yaml:"templateRefs,omitempty"`
}

EngineValidationConfig controls startup and execution-time validation behaviour.

type EnvironmentConfig added in v0.6.0

type EnvironmentConfig struct {
	Provider        string            `json:"provider" yaml:"provider"`
	Region          string            `json:"region,omitempty" yaml:"region,omitempty"`
	EnvVars         map[string]string `json:"envVars,omitempty" yaml:"envVars,omitempty"`
	SecretsProvider string            `json:"secretsProvider,omitempty" yaml:"secretsProvider,omitempty"`
	SecretsPrefix   string            `json:"secretsPrefix,omitempty" yaml:"secretsPrefix,omitempty"`
	// SecretsStoreOverride forces all secrets in this environment to use a specific named store.
	// Overrides defaultStore but is itself overridden by a per-secret Store field.
	SecretsStoreOverride string          `json:"secretsStoreOverride,omitempty" yaml:"secretsStoreOverride,omitempty"`
	ApprovalRequired     bool            `json:"approvalRequired,omitempty" yaml:"approvalRequired,omitempty"`
	Exposure             *ExposureConfig `json:"exposure,omitempty" yaml:"exposure,omitempty"`
}

EnvironmentConfig defines a deployment environment with its provider and overrides.

type ExposeConfig added in v0.7.0

type ExposeConfig struct {
	Port     int    `json:"port" yaml:"port"`
	Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`
}

ExposeConfig defines a port that the service exposes.

type ExposureConfig added in v0.6.0

type ExposureConfig struct {
	Method           string                  `json:"method" yaml:"method"`
	Tailscale        *TailscaleConfig        `json:"tailscale,omitempty" yaml:"tailscale,omitempty"`
	CloudflareTunnel *CloudflareTunnelConfig `json:"cloudflareTunnel,omitempty" yaml:"cloudflareTunnel,omitempty"`
	PortForward      map[string]string       `json:"portForward,omitempty" yaml:"portForward,omitempty"`
}

ExposureConfig defines how a service is exposed to the network.

type ExternalPluginDecl added in v0.3.43

type ExternalPluginDecl struct {
	// Name is the plugin name as registered in the plugin registry.
	Name string `json:"name" yaml:"name"`
	// Version is an optional version specifier forwarded to wfctl plugin install
	// as name@version. Simple constraints (>=, ^, ~) are stripped to extract the
	// version; compound constraints fall back to installing the latest.
	// Used only when AutoFetch is true.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	// AutoFetch controls whether the engine should download the plugin
	// automatically if it is not found in the local plugin directory.
	AutoFetch bool `json:"autoFetch,omitempty" yaml:"autoFetch,omitempty"`
}

ExternalPluginDecl declares an external plugin that the engine should load. When AutoFetch is true and the plugin is not found locally, the engine will call wfctl to download it from the registry before loading.

type FileSource added in v0.2.20

type FileSource struct {
	// contains filtered or unexported fields
}

FileSource loads config from a YAML file on disk.

func NewFileSource added in v0.2.20

func NewFileSource(path string) *FileSource

NewFileSource creates a FileSource that reads from the given path.

func (*FileSource) Hash added in v0.2.20

func (s *FileSource) Hash(_ context.Context) (string, error)

Hash returns the SHA256 hex digest of the raw file bytes.

func (*FileSource) Load added in v0.2.20

Load reads the config file and returns a parsed WorkflowConfig. Supports both ApplicationConfig (multi-workflow) and WorkflowConfig formats.

func (*FileSource) Name added in v0.2.20

func (s *FileSource) Name() string

Name returns a human-readable identifier for this source.

func (*FileSource) Path added in v0.2.20

func (s *FileSource) Path() string

Path returns the filesystem path this source reads from.

type InfraConnectionConfig added in v0.9.0

type InfraConnectionConfig struct {
	Host string `json:"host" yaml:"host"`
	Port int    `json:"port,omitempty" yaml:"port,omitempty"`
	Auth string `json:"auth,omitempty" yaml:"auth,omitempty"`
}

InfraConnectionConfig holds connection details for an existing infrastructure resource.

type InfraEnvironmentResolution added in v0.9.0

type InfraEnvironmentResolution struct {
	// Strategy determines how the resource is obtained: container, provision, existing.
	Strategy string `json:"strategy" yaml:"strategy"`
	// DockerImage is used when Strategy is "container".
	DockerImage string `json:"dockerImage,omitempty" yaml:"dockerImage,omitempty"`
	// Port overrides the default service port when Strategy is "container".
	Port int `json:"port,omitempty" yaml:"port,omitempty"`
	// Provider names the cloud provider when Strategy is "provision".
	Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`
	// Config holds provider-specific provisioning options.
	Config map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
	// Connection holds connection details when Strategy is "existing".
	Connection *InfraConnectionConfig `json:"connection,omitempty" yaml:"connection,omitempty"`
}

InfraEnvironmentResolution defines how an infrastructure resource is resolved in a specific environment. A strategy of "container" means run it as a local Docker container, "provision" means create it via a cloud provider, and "existing" means connect to an already-running instance.

type InfraRequirement added in v0.9.0

type InfraRequirement struct {
	Type        string   `json:"type" yaml:"type"`
	Name        string   `json:"name" yaml:"name"`
	Description string   `json:"description" yaml:"description"`
	DockerImage string   `json:"dockerImage,omitempty" yaml:"dockerImage,omitempty"`
	Ports       []int    `json:"ports,omitempty" yaml:"ports,omitempty"`
	Secrets     []string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
	Providers   []string `json:"providers,omitempty" yaml:"providers,omitempty"`
	Optional    bool     `json:"optional,omitempty" yaml:"optional,omitempty"`
}

InfraRequirement is a single infrastructure dependency.

type InfraResourceConfig added in v0.3.39

type InfraResourceConfig struct {
	Name     string         `json:"name" yaml:"name"`
	Type     string         `json:"type" yaml:"type"`
	Provider string         `json:"provider,omitempty" yaml:"provider,omitempty"`
	Config   map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
	// Environments maps environment names to per-environment resolution strategies.
	Environments map[string]*InfraEnvironmentResolution `json:"environments,omitempty" yaml:"environments,omitempty"`
}

InfraResourceConfig describes a single infrastructure resource to provision.

type InfrastructureConfig added in v0.3.39

type InfrastructureConfig struct {
	Resources []InfraResourceConfig `json:"resources" yaml:"resources"`
}

InfrastructureConfig holds infrastructure resource declarations.

type IngressConfig added in v0.7.0

type IngressConfig struct {
	Service      string     `json:"service,omitempty" yaml:"service,omitempty"`
	Port         int        `json:"port" yaml:"port"`
	ExternalPort int        `json:"externalPort,omitempty" yaml:"externalPort,omitempty"`
	Protocol     string     `json:"protocol,omitempty" yaml:"protocol,omitempty"`
	Path         string     `json:"path,omitempty" yaml:"path,omitempty"`
	TLS          *TLSConfig `json:"tls,omitempty" yaml:"tls,omitempty"`
}

IngressConfig defines an externally-accessible endpoint.

type MeshConfig added in v0.7.0

type MeshConfig struct {
	Transport string            `json:"transport,omitempty" yaml:"transport,omitempty"`
	Discovery string            `json:"discovery,omitempty" yaml:"discovery,omitempty"`
	NATS      *MeshNATSConfig   `json:"nats,omitempty" yaml:"nats,omitempty"`
	Routes    []MeshRouteConfig `json:"routes,omitempty" yaml:"routes,omitempty"`
}

MeshConfig defines inter-service communication.

type MeshNATSConfig added in v0.7.0

type MeshNATSConfig struct {
	URL       string `json:"url" yaml:"url"`
	ClusterID string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"`
}

MeshNATSConfig holds NATS-specific mesh configuration.

type MeshRouteConfig added in v0.7.0

type MeshRouteConfig struct {
	From     string `json:"from" yaml:"from"`
	To       string `json:"to" yaml:"to"`
	Via      string `json:"via" yaml:"via"`
	Subject  string `json:"subject,omitempty" yaml:"subject,omitempty"`
	Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
}

MeshRouteConfig declares a communication path between services.

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 ModuleConfigChange added in v0.2.20

type ModuleConfigChange struct {
	Name      string
	OldConfig map[string]any
	NewConfig map[string]any
}

ModuleConfigChange represents a change to a single module's config.

type ModuleConfigDiff added in v0.2.20

type ModuleConfigDiff struct {
	Added     []ModuleConfig       // modules in new but not old
	Removed   []ModuleConfig       // modules in old but not new
	Modified  []ModuleConfigChange // modules present in both with different config
	Unchanged []string             // module names with no config change
}

ModuleConfigDiff represents what changed between two configs.

func DiffModuleConfigs added in v0.2.20

func DiffModuleConfigs(old, new *WorkflowConfig) *ModuleConfigDiff

DiffModuleConfigs compares two configs and identifies module-level changes.

type ModuleInfraSpec added in v0.9.0

type ModuleInfraSpec struct {
	Requires []InfraRequirement `json:"requires" yaml:"requires"`
}

ModuleInfraSpec declares what a module type requires.

type ModuleReconfigurer added in v0.2.20

type ModuleReconfigurer interface {
	// ReconfigureModules applies new configuration to specific running modules.
	// Returns the names of any modules that could not be reconfigured in-place
	// (requiring a full reload) and any hard error.
	ReconfigureModules(ctx context.Context, changes []ModuleConfigChange) (failedModules []string, err error)
}

ModuleReconfigurer is implemented by the engine to support partial (per-module) reloads. When a config change only affects module configs, the engine can apply changes surgically rather than performing a full stop/rebuild/start cycle.

type NetworkPolicy added in v0.7.0

type NetworkPolicy struct {
	From string   `json:"from" yaml:"from"`
	To   []string `json:"to" yaml:"to"`
}

NetworkPolicy defines allowed communication between services.

type NetworkingConfig added in v0.7.0

type NetworkingConfig struct {
	Ingress  []IngressConfig `json:"ingress,omitempty" yaml:"ingress,omitempty"`
	Policies []NetworkPolicy `json:"policies,omitempty" yaml:"policies,omitempty"`
	DNS      *DNSConfig      `json:"dns,omitempty" yaml:"dns,omitempty"`
}

NetworkingConfig defines network exposure and policies.

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"`
	// Outputs declares the named output fields that this pipeline is expected
	// to produce. This is an optional, backwards-compatible declaration —
	// existing pipelines without an Outputs block continue to work unchanged.
	// When present, it enables:
	//   - wfctl contract test to include response schemas in endpoint contracts
	//   - tools that understand pipeline outputs (for example, step.workflow_call)
	//     to validate or document output_mapping and other response shapes
	Outputs map[string]PipelineOutputDef `json:"outputs,omitempty" yaml:"outputs,omitempty"`
	// StrictTemplates causes the pipeline to return an error when any template
	// expression references a missing map key, instead of silently using the zero
	// value. Useful for catching typos in step field references at runtime.
	// Default is false (missing keys produce a warning log and resolve to zero).
	StrictTemplates bool `json:"strict_templates,omitempty" yaml:"strict_templates,omitempty"`
}

PipelineConfig represents a single composable pipeline definition.

type PipelineOutputDef added in v0.3.66

type PipelineOutputDef struct {
	Type        string `json:"type" yaml:"type"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

PipelineOutputDef describes a single declared output field of a pipeline. When a pipeline declares its outputs, callers (HTTP triggers, step.workflow_call, wfctl contract test) can validate or document the expected response shape.

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"`
	// SkipIf is an optional Go template expression. When it evaluates to a
	// truthy value (non-empty, not "false", not "0"), the step is skipped and
	// the pipeline continues with the next step. Falsy or absent → execute.
	SkipIf string `json:"skip_if,omitempty" yaml:"skip_if,omitempty"`
	// If is the logical inverse of SkipIf: the step executes only when the
	// template evaluates to truthy. Falsy or absent with no SkipIf → execute.
	// When both SkipIf and If are set, SkipIf takes precedence.
	If string `json:"if,omitempty" yaml:"if,omitempty"`
	// ErrorStatus overrides the HTTP response status code when this step fails.
	// Use 400 for bad requests, 422 for unprocessable entity, etc.
	// When set, the step error is wrapped in a ValidationError so the HTTP
	// handler returns the specified status code instead of 500.
	ErrorStatus int `json:"error_status,omitempty" yaml:"error_status,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 PluginCapabilities added in v0.9.0

type PluginCapabilities struct {
	ModuleTypes  []string `json:"moduleTypes" yaml:"moduleTypes"`
	StepTypes    []string `json:"stepTypes" yaml:"stepTypes"`
	TriggerTypes []string `json:"triggerTypes" yaml:"triggerTypes"`
}

PluginCapabilities describes what module, step, and trigger types a plugin provides.

type PluginInfraRequirements added in v0.9.0

type PluginInfraRequirements map[string]*ModuleInfraSpec

PluginInfraRequirements maps module types to their infrastructure needs.

type PluginManifestFile added in v0.9.0

type PluginManifestFile struct {
	Name                    string                  `json:"name" yaml:"name"`
	Version                 string                  `json:"version" yaml:"version"`
	Description             string                  `json:"description" yaml:"description"`
	Capabilities            PluginCapabilities      `json:"capabilities" yaml:"capabilities"`
	ModuleInfraRequirements PluginInfraRequirements `json:"moduleInfraRequirements,omitempty" yaml:"moduleInfraRequirements,omitempty"`
}

PluginManifestFile represents the full plugin.json manifest.

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 PluginsConfig added in v0.3.43

type PluginsConfig struct {
	// External lists external plugins that the engine should discover and load.
	External []ExternalPluginDecl `json:"external,omitempty" yaml:"external,omitempty"`
}

PluginsConfig holds the top-level plugins configuration section.

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 ScalingConfig added in v0.7.0

type ScalingConfig struct {
	Replicas int    `json:"replicas,omitempty" yaml:"replicas,omitempty"`
	Min      int    `json:"min,omitempty" yaml:"min,omitempty"`
	Max      int    `json:"max,omitempty" yaml:"max,omitempty"`
	Metric   string `json:"metric,omitempty" yaml:"metric,omitempty"`
	Target   int    `json:"target,omitempty" yaml:"target,omitempty"`
}

ScalingConfig defines how a service scales.

type SecretEntry added in v0.6.0

type SecretEntry struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// Store names the store (from secretStores) this secret lives in.
	// Overrides defaultStore and environment secretsStoreOverride.
	Store    string                 `json:"store,omitempty" yaml:"store,omitempty"`
	Rotation *SecretsRotationConfig `json:"rotation,omitempty" yaml:"rotation,omitempty"`
}

SecretEntry declares a single secret the application needs.

type SecretStoreConfig added in v0.9.0

type SecretStoreConfig struct {
	Provider string         `json:"provider" yaml:"provider"`
	Config   map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

SecretStoreConfig defines a named secret storage backend.

type SecretsConfig added in v0.6.0

type SecretsConfig struct {
	// DefaultStore names the store (from secretStores) to use when a secret has no explicit store.
	DefaultStore string `json:"defaultStore,omitempty" yaml:"defaultStore,omitempty"`
	// Entries lists the secrets this application requires.
	Entries []SecretEntry `json:"entries,omitempty" yaml:"entries,omitempty"`
	// Provider is the legacy single-store provider name. Kept for backward compatibility.
	// Prefer secretStores + defaultStore for new configs.
	Provider string                 `json:"provider,omitempty" yaml:"provider,omitempty"`
	Config   map[string]any         `json:"config,omitempty" yaml:"config,omitempty"`
	Rotation *SecretsRotationConfig `json:"rotation,omitempty" yaml:"rotation,omitempty"`
}

SecretsConfig defines secret management for the application.

type SecretsRotationConfig added in v0.6.0

type SecretsRotationConfig struct {
	Enabled  bool   `json:"enabled" yaml:"enabled"`
	Interval string `json:"interval,omitempty" yaml:"interval,omitempty"`
	Strategy string `json:"strategy,omitempty" yaml:"strategy,omitempty"`
}

SecretsRotationConfig defines default rotation policy.

type SecurityConfig added in v0.7.0

type SecurityConfig struct {
	TLS      *SecurityTLSConfig      `json:"tls,omitempty" yaml:"tls,omitempty"`
	Network  *SecurityNetworkConfig  `json:"network,omitempty" yaml:"network,omitempty"`
	Identity *SecurityIdentityConfig `json:"identity,omitempty" yaml:"identity,omitempty"`
	Runtime  *SecurityRuntimeConfig  `json:"runtime,omitempty" yaml:"runtime,omitempty"`
	Scanning *SecurityScanningConfig `json:"scanning,omitempty" yaml:"scanning,omitempty"`
}

SecurityConfig defines security policies for the application.

type SecurityIdentityConfig added in v0.7.0

type SecurityIdentityConfig struct {
	Provider   string `json:"provider,omitempty" yaml:"provider,omitempty"`
	PerService bool   `json:"perService,omitempty" yaml:"perService,omitempty"`
}

SecurityIdentityConfig defines service identity management.

type SecurityNetworkConfig added in v0.7.0

type SecurityNetworkConfig struct {
	DefaultPolicy string `json:"defaultPolicy,omitempty" yaml:"defaultPolicy,omitempty"`
}

SecurityNetworkConfig defines network isolation policy.

type SecurityRuntimeConfig added in v0.7.0

type SecurityRuntimeConfig struct {
	ReadOnlyFilesystem bool     `json:"readOnlyFilesystem,omitempty" yaml:"readOnlyFilesystem,omitempty"`
	NoNewPrivileges    bool     `json:"noNewPrivileges,omitempty" yaml:"noNewPrivileges,omitempty"`
	RunAsNonRoot       bool     `json:"runAsNonRoot,omitempty" yaml:"runAsNonRoot,omitempty"`
	DropCapabilities   []string `json:"dropCapabilities,omitempty" yaml:"dropCapabilities,omitempty"`
	AddCapabilities    []string `json:"addCapabilities,omitempty" yaml:"addCapabilities,omitempty"`
}

SecurityRuntimeConfig defines container runtime security.

type SecurityScanningConfig added in v0.7.0

type SecurityScanningConfig struct {
	ContainerScan  bool `json:"containerScan,omitempty" yaml:"containerScan,omitempty"`
	DependencyScan bool `json:"dependencyScan,omitempty" yaml:"dependencyScan,omitempty"`
	SAST           bool `json:"sast,omitempty" yaml:"sast,omitempty"`
}

SecurityScanningConfig defines automated security scanning.

type SecurityTLSConfig added in v0.7.0

type SecurityTLSConfig struct {
	Internal   bool   `json:"internal,omitempty" yaml:"internal,omitempty"`
	External   bool   `json:"external,omitempty" yaml:"external,omitempty"`
	Provider   string `json:"provider,omitempty" yaml:"provider,omitempty"`
	MinVersion string `json:"minVersion,omitempty" yaml:"minVersion,omitempty"`
}

SecurityTLSConfig defines TLS requirements.

type ServiceConfig added in v0.7.0

type ServiceConfig struct {
	Description string         `json:"description,omitempty" yaml:"description,omitempty"`
	Binary      string         `json:"binary,omitempty" yaml:"binary,omitempty"`
	Scaling     *ScalingConfig `json:"scaling,omitempty" yaml:"scaling,omitempty"`
	Modules     []ModuleConfig `json:"modules,omitempty" yaml:"modules,omitempty"`
	Workflows   map[string]any `json:"workflows,omitempty" yaml:"workflows,omitempty"`
	Pipelines   map[string]any `json:"pipelines,omitempty" yaml:"pipelines,omitempty"`
	Triggers    map[string]any `json:"triggers,omitempty" yaml:"triggers,omitempty"`
	Plugins     []string       `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	Expose      []ExposeConfig `json:"expose,omitempty" yaml:"expose,omitempty"`
}

ServiceConfig defines a single service within a multi-service application.

type SidecarConfig added in v0.3.5

type SidecarConfig 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"`
}

SidecarConfig defines a sidecar container to run alongside the workflow application.

type TLSConfig added in v0.7.0

type TLSConfig struct {
	Provider   string `json:"provider,omitempty" yaml:"provider,omitempty"`
	Domain     string `json:"domain,omitempty" yaml:"domain,omitempty"`
	MinVersion string `json:"minVersion,omitempty" yaml:"minVersion,omitempty"`
}

TLSConfig defines TLS termination.

type TailscaleConfig added in v0.6.0

type TailscaleConfig struct {
	Funnel   bool   `json:"funnel,omitempty" yaml:"funnel,omitempty"`
	Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
}

TailscaleConfig for Tailscale Funnel exposure.

type WatcherOption added in v0.2.20

type WatcherOption func(*ConfigWatcher)

WatcherOption configures a ConfigWatcher.

func WithWatchDebounce added in v0.2.20

func WithWatchDebounce(d time.Duration) WatcherOption

WithWatchDebounce sets the debounce duration for file change events.

func WithWatchLogger added in v0.2.20

func WithWatchLogger(l *slog.Logger) WatcherOption

WithWatchLogger sets the logger for the watcher.

type WorkflowConfig

type WorkflowConfig struct {
	Imports        []string                      `json:"imports,omitempty" yaml:"imports,omitempty"`
	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"`
	Plugins        *PluginsConfig                `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	Sidecars       []SidecarConfig               `json:"sidecars,omitempty" yaml:"sidecars,omitempty"`
	Infrastructure *InfrastructureConfig         `json:"infrastructure,omitempty" yaml:"infrastructure,omitempty"`
	Engine         *EngineConfig                 `json:"engine,omitempty" yaml:"engine,omitempty"`
	CI             *CIConfig                     `json:"ci,omitempty" yaml:"ci,omitempty"`
	Environments   map[string]*EnvironmentConfig `json:"environments,omitempty" yaml:"environments,omitempty"`
	Secrets        *SecretsConfig                `json:"secrets,omitempty" yaml:"secrets,omitempty"`
	SecretStores   map[string]*SecretStoreConfig `json:"secretStores,omitempty" yaml:"secretStores,omitempty"`
	Services       map[string]*ServiceConfig     `json:"services,omitempty" yaml:"services,omitempty"`
	Mesh           *MeshConfig                   `json:"mesh,omitempty" yaml:"mesh,omitempty"`
	Networking     *NetworkingConfig             `json:"networking,omitempty" yaml:"networking,omitempty"`
	Security       *SecurityConfig               `json:"security,omitempty" yaml:"security,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 DeepMergeConfigs added in v0.3.3

func DeepMergeConfigs(base, override *WorkflowConfig) *WorkflowConfig

DeepMergeConfigs merges override config on top of base config with override-wins semantics. Unlike MergeConfigs (which uses primary-wins for fragment injection), this uses override-wins for tenant config customization.

func LoadFromBytes added in v0.3.21

func LoadFromBytes(data []byte) (*WorkflowConfig, error)

LoadFromBytes loads a workflow configuration from a YAML byte slice. This is useful for loading embedded configs (e.g. via //go:embed). Note: imports are NOT processed because there is no file path context to resolve relative import paths against.

func LoadFromFile

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

LoadFromFile loads a workflow configuration from a YAML file. If the config contains an "imports" field, referenced files are loaded recursively and merged. The importing file's definitions take precedence over imported ones for map-based fields (workflows, triggers, pipelines, platform). Modules are concatenated with the main file's modules first.

func LoadFromString

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

LoadFromString loads a workflow configuration from a YAML string. Note: imports are NOT processed when loading from a string because there is no file path context to resolve relative import paths against.

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