config

package
v0.4.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSite

func AddSite(site Site) error

AddSite appends or updates a site in the registry.

func BinDir

func BinDir() string

BinDir returns the lerd bin directory.

func CertsDir

func CertsDir() string

CertsDir returns the certs directory.

func ConfigDir

func ConfigDir() string

ConfigDir returns ~/.config/lerd/ (or $XDG_CONFIG_HOME/lerd/).

func DataDir

func DataDir() string

DataDir returns ~/.local/share/lerd/ (or $XDG_DATA_HOME/lerd/).

func DataSubDir

func DataSubDir(name string) string

DataSubDir returns a named subdirectory under data.

func DnsmasqDir

func DnsmasqDir() string

DnsmasqDir returns the dnsmasq config directory.

func GlobalConfigFile

func GlobalConfigFile() string

GlobalConfigFile returns the path to config.yaml.

func IgnoreSite added in v0.3.0

func IgnoreSite(name string) error

IgnoreSite marks a site as ignored (used for parked sites that have been unlinked).

func NginxConfD

func NginxConfD() string

NginxConfD returns the nginx conf.d directory.

func NginxDir

func NginxDir() string

NginxDir returns the nginx data directory.

func PHPConfFile added in v0.4.0

func PHPConfFile(version string) string

PHPConfFile returns the host path for the per-version xdebug ini file.

func PHPImageHashFile added in v0.1.25

func PHPImageHashFile() string

PHPImageHashFile returns the path to the stored PHP-FPM Containerfile hash.

func QuadletDir

func QuadletDir() string

QuadletDir returns the Podman quadlet directory.

func RemoveSite

func RemoveSite(name string) error

RemoveSite removes a site by name from the registry.

func SaveGlobal

func SaveGlobal(cfg *GlobalConfig) error

SaveGlobal writes the configuration to config.yaml.

func SaveSites

func SaveSites(reg *SiteRegistry) error

SaveSites writes the registry to sites.yaml.

func SitesFile

func SitesFile() string

SitesFile returns the path to sites.yaml.

func SystemdUserDir

func SystemdUserDir() string

SystemdUserDir returns the systemd user unit directory.

Types

type GlobalConfig

type GlobalConfig struct {
	PHP struct {
		DefaultVersion string          `yaml:"default_version" mapstructure:"default_version"`
		XdebugEnabled  map[string]bool `yaml:"xdebug_enabled"  mapstructure:"xdebug_enabled"`
	} `yaml:"php" mapstructure:"php"`
	Node struct {
		DefaultVersion string `yaml:"default_version" mapstructure:"default_version"`
	} `yaml:"node" mapstructure:"node"`
	Nginx struct {
		HTTPPort  int `yaml:"http_port"  mapstructure:"http_port"`
		HTTPSPort int `yaml:"https_port" mapstructure:"https_port"`
	} `yaml:"nginx" mapstructure:"nginx"`
	DNS struct {
		TLD string `yaml:"tld" mapstructure:"tld"`
	} `yaml:"dns" mapstructure:"dns"`
	ParkedDirectories []string                 `yaml:"parked_directories" mapstructure:"parked_directories"`
	Services          map[string]ServiceConfig `yaml:"services"           mapstructure:"services"`
}

GlobalConfig is the top-level lerd configuration.

func LoadGlobal

func LoadGlobal() (*GlobalConfig, error)

LoadGlobal reads config.yaml via viper, returning defaults if the file is absent.

func (*GlobalConfig) IsXdebugEnabled added in v0.4.0

func (c *GlobalConfig) IsXdebugEnabled(version string) bool

IsXdebugEnabled returns true if Xdebug is enabled for the given PHP version.

func (*GlobalConfig) SetXdebug added in v0.4.0

func (c *GlobalConfig) SetXdebug(version string, enabled bool)

SetXdebug enables or disables Xdebug for the given PHP version.

type ServiceConfig

type ServiceConfig struct {
	Enabled bool   `yaml:"enabled" mapstructure:"enabled"`
	Image   string `yaml:"image"   mapstructure:"image"`
	Port    int    `yaml:"port"    mapstructure:"port"`
}

ServiceConfig holds configuration for an optional service.

type Site

type Site struct {
	Name        string `yaml:"name"`
	Domain      string `yaml:"domain"`
	Path        string `yaml:"path"`
	PHPVersion  string `yaml:"php_version"`
	NodeVersion string `yaml:"node_version"`
	Secured     bool   `yaml:"secured"`
	Ignored     bool   `yaml:"ignored,omitempty"`
}

Site represents a single registered Lerd site.

func FindSite

func FindSite(name string) (*Site, error)

FindSite returns the site with the given name, or an error if not found.

func FindSiteByDomain added in v0.1.37

func FindSiteByDomain(domain string) (*Site, error)

FindSiteByDomain returns the site with the given domain, or an error if not found.

func FindSiteByPath added in v0.3.0

func FindSiteByPath(path string) (*Site, error)

FindSiteByPath returns the site whose path matches, or an error if not found.

type SiteRegistry

type SiteRegistry struct {
	Sites []Site `yaml:"sites"`
}

SiteRegistry holds all registered sites.

func LoadSites

func LoadSites() (*SiteRegistry, error)

LoadSites reads sites.yaml, returning an empty registry if the file does not exist.

Jump to

Keyboard shortcuts

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