composefile

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package composefile holds small, dependency-light helpers for inspecting a Compose document at the YAML-node level. It exists mainly so the doctor command can compare a live compose file against WhatTheDock's own pre-apply backups without importing the whole TUI package.

Index

Constants

This section is empty.

Variables

View Source
var ManagedKeys = map[string]bool{
	"image":       true,
	"restart":     true,
	"command":     true,
	"ports":       true,
	"volumes":     true,
	"environment": true,
}

ManagedKeys are the service keys the WhatTheDock form owns and is allowed to change or remove (image/restart/command/ports/volumes/environment). A loss outside this set is never a deliberate form edit.

Functions

func LostUnmanagedKeys

func LostUnmanagedKeys(current, backup []byte, service string) ([]string, error)

LostUnmanagedKeys returns, sorted, the unmanaged service keys present in backup but absent from current. Those are exactly the keys a form-driven apply should never remove (build, container_name, network_mode, depends_on, ...), so their disappearance is the signature of an apply that overwrote more of the file than it should have. A service absent from either file yields no loss (that's a create or a delete, not a silent field drop).

func ServiceKeys

func ServiceKeys(content []byte, service string) (map[string]bool, error)

ServiceKeys returns the set of top-level mapping keys on service's block in a Compose document. A document that doesn't define the service yields an empty set, not an error, so callers can compare across versions where the service appeared or disappeared.

Types

This section is empty.

Jump to

Keyboard shortcuts

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