envcompare

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package envcompare answers "how do this stack's environments differ from the first one": one row per tile slug, one cell per environment, the keys that differ, and which of those someone has marked as on purpose. It reads the same serialized form the config planner does, so the keys are the config file's keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	EnvID string
	State string // ref | same | differs | missing | intended
	Keys  []Key  // set for differs and intended
}

Cell is one tile in one env, compared to the reference.

func (Cell) Fields

func (c Cell) Fields() map[string]bool

Fields is the top-level config fields behind a cell's keys, the form the applier's update path takes ("env.PORT" → "env").

func (Cell) Value

func (c Cell) Value(key string) string

Value is the current value of one key in the cell, "" when it is not among the differing keys.

type Key

type Key struct {
	Name     string
	Ref      string // the reference env's value ("" = not set there)
	Val      string // this env's value
	Intended bool
}

Key is one differing key on one tile in one env.

type Result

type Result struct {
	Envs    []repo.Environment // static envs in ladder order; [0] is the reference
	Rows    []Row
	Differs int // cells that differ and are not intended, across every env
	Missing int // cells whose tile the env does not have
}

Result is the whole comparison.

func Compare

func Compare(stackName string, envs []repo.Environment, state stackconf.State, intended map[string][]repo.Intended) Result

Compare builds the result. state is the planner's Snapshot; intended is the intended rows per env id.

type Row

type Row struct {
	Slug  string
	Cells []Cell // one per env, in Result.Envs order; Cells[0] is the reference
}

Row is one tile slug across the environments.

Jump to

Keyboard shortcuts

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