siteinfo

package
v1.12.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownServices = []string{"mysql", "redis", "postgres", "meilisearch", "rustfs", "mailpit"}

KnownServices lists the built-in service names used for auto-detection.

Functions

func DetectFavicon

func DetectFavicon(sitePath, publicDir, framework string, fw *config.Framework, hasFw bool) string

DetectFavicon returns the absolute path of the first favicon file found in the site's public directory, or empty string if none found. When fw/hasFw are not available, pass nil/false and the function will look them up from the framework name.

func FrameworkLabel

func FrameworkLabel(name, path string) string

FrameworkLabel returns the display label for a framework name. Exported for use by callers that need the label without full enrichment.

func InvalidateUnitCache added in v1.12.0

func InvalidateUnitCache()

InvalidateUnitCache forces the next UnitStatus lookup to re-run systemctl. Call this after any mutation that changes lerd-* unit state (start, stop, enable, disable, etc.) so cached "active" values do not go stale.

func PersistVersionChanges

func PersistVersionChanges(sites []EnrichedSite) error

PersistVersionChanges writes back any detected version changes to the site registry.

Types

type ConflictingDomain

type ConflictingDomain struct {
	Domain  string
	OwnedBy string
}

ConflictingDomain describes a domain declared in .lerd.yaml that is owned by a different site on this machine.

type EnrichFlag

type EnrichFlag uint32

EnrichFlag controls which enrichment steps run during site loading.

const (
	EnrichFramework       EnrichFlag = 1 << iota // framework label + version
	EnrichVersions                               // live PHP/Node detection from disk
	EnrichWorkers                                // worker status via podman
	EnrichFPM                                    // FPM container running check
	EnrichGit                                    // worktrees + main branch
	EnrichServices                               // .env + .lerd.yaml service detection
	EnrichDomainConflicts                        // conflicting domain check
	EnrichLogs                                   // app log file detection
	EnrichFavicon                                // favicon detection
	EnrichStripe                                 // stripe secret check

	EnrichCLI = EnrichFramework | EnrichGit
	EnrichMCP = EnrichFramework | EnrichWorkers
	EnrichUI  = EnrichFramework | EnrichVersions | EnrichWorkers |
		EnrichFPM | EnrichGit | EnrichServices |
		EnrichDomainConflicts | EnrichLogs | EnrichFavicon | EnrichStripe
)

type EnrichedSite

type EnrichedSite struct {
	// Base fields from config.Site
	Name          string
	Domains       []string
	Path          string
	PHPVersion    string
	NodeVersion   string
	Secured       bool
	Paused        bool
	PausedWorkers []string
	PublicDir     string
	AppURL        string

	// Framework
	FrameworkName    string
	FrameworkLabel   string
	FrameworkVersion string

	// Runtime status
	FPMRunning bool

	// Well-known workers
	HasQueueWorker    bool
	QueueRunning      bool
	QueueFailing      bool
	HasScheduleWorker bool
	ScheduleRunning   bool
	ScheduleFailing   bool
	HasReverb         bool
	ReverbRunning     bool
	ReverbFailing     bool
	HasHorizon        bool
	HorizonRunning    bool
	HorizonFailing    bool
	StripeSecretSet   bool
	StripeRunning     bool

	// Custom framework workers
	FrameworkWorkers []WorkerInfo

	// Git
	Branch    string
	Worktrees []WorktreeInfo

	// Domain conflicts
	ConflictingDomains []ConflictingDomain

	// Services
	Services []string

	// App metadata
	HasAppLogs    bool
	LatestLogTime string
	HasFavicon    bool

	// Version change tracking (for write-back by caller)
	PHPVersionChanged   bool
	NodeVersionChanged  bool
	OriginalPHPVersion  string
	OriginalNodeVersion string
}

EnrichedSite is the superset of site information needed by all surfaces.

func Enrich

func Enrich(s config.Site, flags EnrichFlag) EnrichedSite

Enrich populates an EnrichedSite from a config.Site according to the given flags.

func LoadAll

func LoadAll(flags EnrichFlag) ([]EnrichedSite, error)

LoadAll loads all non-ignored sites and enriches them according to flags.

func (*EnrichedSite) PrimaryDomain

func (e *EnrichedSite) PrimaryDomain() string

PrimaryDomain returns the first domain or empty string.

type WorkerInfo

type WorkerInfo struct {
	Name    string
	Label   string
	Running bool
	Failing bool
}

WorkerInfo describes a framework worker and its runtime state.

type WorktreeInfo

type WorktreeInfo struct {
	Branch string
	Domain string
	Path   string
}

WorktreeInfo describes a git worktree associated with a site.

Jump to

Keyboard shortcuts

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