diff

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(result *Result, showSecrets bool) string

Format renders a diff Result as human-readable text. When showSecrets is false, live values of sensitive variables are masked.

Types

type Action

type Action int

Action represents the type of change.

const (
	ActionCreate Action = iota
	ActionUpdate
	ActionDelete
)

func (Action) String

func (a Action) String() string

String returns a human-readable label.

type Change

type Change struct {
	Key          string
	Action       Action
	LiveValue    string // current value in Railway (empty for Create)
	DesiredValue string // desired value from config (empty for Delete)
}

Change represents a single variable or setting change.

type Options added in v0.2.0

type Options struct {
	Create bool // include creates (default true)
	Update bool // include updates (default true)
	Delete bool // include deletes (default false)
}

Options controls which change types are included in the diff.

func DefaultOptions added in v0.2.0

func DefaultOptions() Options

DefaultOptions returns the default diff options.

type Result

type Result struct {
	Shared   *SectionDiff
	Services map[string]*SectionDiff // keyed by service name
}

Result holds the complete diff between desired config and live state.

func Compute

func Compute(desired *config.DesiredConfig, live *config.LiveConfig) *Result

Compute calculates the diff between desired and live config. It uses DefaultOptions (create+update, no delete).

func ComputeWithOptions added in v0.2.0

func ComputeWithOptions(desired *config.DesiredConfig, live *config.LiveConfig, opts Options) *Result

ComputeWithOptions calculates the diff between desired and live config, filtering changes by the provided options.

func (*Result) IsEmpty

func (r *Result) IsEmpty() bool

IsEmpty returns true if there are no changes.

type SectionDiff

type SectionDiff struct {
	Variables    []Change
	Settings     []Change
	SubResources []SubResourceChange
}

SectionDiff holds diffs for one scope (shared or a service).

type SubResourceChange added in v0.2.0

type SubResourceChange struct {
	Type     string // "domain", "volume", "tcp_proxy", "network", "trigger", "egress"
	Action   Action
	Key      string   // human-readable key (domain name, mount path, port, etc.)
	LiveID   string   // ID for deletes
	Port     int      // for domains/TCP proxies
	Mount    string   // for volumes
	Repo     string   // for triggers
	Branch   string   // for triggers
	Regions  []string // for egress (set semantics)
	IsCustom bool     // for domains: true = custom, false = service domain
}

SubResourceChange represents a create or delete for a sub-resource (domain, volume, TCP proxy, network, trigger, egress).

Jump to

Keyboard shortcuts

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