Documentation
¶
Index ¶
- func SetLogger(l *slog.Logger)
- func Watch(dirs []string, onNew func(path string), onRemoved func(path string)) error
- func WatchDNS(interval time.Duration, tld string)
- func WatchHostGateway(interval time.Duration)
- func WatchSiteFiles(getSites func() []string, debounce time.Duration, ...) error
- func WatchWorktrees(getSites func() []string, onAdded func(sitePath, name string), ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLogger ¶ added in v0.9.0
SetLogger replaces the watcher logger. Call before starting any watchers.
func Watch ¶
Watch monitors the given directories for new and deleted project subdirectories. onNew is called when a framework signal file appears in a direct subdirectory of a parked dir. onRemoved is called when a watched subdirectory is deleted.
func WatchDNS ¶ added in v0.8.2
WatchDNS polls DNS health for the given TLD every interval. When resolution is broken it waits for lerd-dns to be ready and re-applies the resolver configuration, replicating the DNS repair done by lerd start.
func WatchHostGateway ¶ added in v1.15.1
WatchHostGateway keeps the host.containers.internal entry in the shared PHP-FPM /etc/hosts file pointing at an IP that actually routes back to the host. Without this, a laptop that changes networks (coffee shop to home wifi to mobile hotspot) ends up with a stale LAN IP in /etc/hosts and Xdebug silently times out until the next `lerd start`.
Steady-state cost is deliberately near-zero: we track the host's primary LAN IP across ticks and only run the expensive podman exec reachability probe when it changes. The LAN-IP lookup is a Go net.Dial("udp4", "1.1.1.1:80") which never sends a packet — the kernel just returns the route source address — so it's microseconds per tick. This matters on macOS in particular, where podman exec goes through the podman-machine VM's gvproxy / sshd / runtime and costs 300 ms – 1 s per call.
A LAN change on macOS doesn't necessarily invalidate gvproxy's host.containers.internal address, so the reprobe after a LAN rotation may turn up the same IP on disk and correctly skip the write. One spurious podman exec per real network change is cheap enough not to justify a platform-specific fast path.
func WatchSiteFiles ¶ added in v0.8.0
func WatchSiteFiles(getSites func() []string, debounce time.Duration, onChanged func(sitePath string)) error
WatchSiteFiles monitors key config files in each site directory returned by getSites. onChanged is called at most once per debounce period per site when any of the watched files are written or replaced.
func WatchWorktrees ¶ added in v0.6.0
func WatchWorktrees( getSites func() []string, onAdded func(sitePath, name string), onRemoved func(sitePath, name string), ) error
WatchWorktrees monitors the .git/worktrees/ directory for each site returned by getSites and calls onAdded/onRemoved when entries appear or disappear. It also watches .git/ itself so it can re-attach to .git/worktrees/ if it is deleted (last worktree removed) and then re-created (first new worktree added). It re-polls getSites every 30 seconds to pick up newly registered sites.
Types ¶
This section is empty.