Documentation
¶
Index ¶
- func AddSite(site Site) error
- func BinDir() string
- func CertsDir() string
- func ConfigDir() string
- func CustomServicesDir() string
- func DataDir() string
- func DataSubDir(name string) string
- func DnsmasqDir() string
- func GlobalConfigFile() string
- func IgnoreSite(name string) error
- func NginxConfD() string
- func NginxDir() string
- func PHPConfFile(version string) string
- func PHPImageHashFile() string
- func PHPUserIniFile(version string) string
- func QuadletDir() string
- func RemoveCustomService(name string) error
- func RemoveSite(name string) error
- func SaveCustomService(svc *CustomService) error
- func SaveGlobal(cfg *GlobalConfig) error
- func SaveSites(reg *SiteRegistry) error
- func ServiceIsPaused(name string) bool
- func SetServicePaused(name string, paused bool) error
- func SitesFile() string
- func SystemdUserDir() string
- func UpdateCheckFile() string
- type CustomService
- type EnvDetect
- type GlobalConfig
- func (c *GlobalConfig) AddExtension(version, ext string)
- func (c *GlobalConfig) GetExtensions(version string) []string
- func (c *GlobalConfig) IsXdebugEnabled(version string) bool
- func (c *GlobalConfig) RemoveExtension(version, ext string)
- func (c *GlobalConfig) SetXdebug(version string, enabled bool)
- type ServiceConfig
- type Site
- type SiteInit
- type SiteRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns ~/.config/lerd/ (or $XDG_CONFIG_HOME/lerd/).
func CustomServicesDir ¶ added in v0.5.4
func CustomServicesDir() string
CustomServicesDir returns the directory for custom service YAML files.
func DataDir ¶
func DataDir() string
DataDir returns ~/.local/share/lerd/ (or $XDG_DATA_HOME/lerd/).
func DataSubDir ¶
DataSubDir returns a named subdirectory under data.
func GlobalConfigFile ¶
func GlobalConfigFile() string
GlobalConfigFile returns the path to config.yaml.
func IgnoreSite ¶ added in v0.3.0
IgnoreSite marks a site as ignored (used for parked sites that have been unlinked).
func PHPConfFile ¶ added in v0.4.0
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 PHPUserIniFile ¶ added in v0.5.5
PHPUserIniFile returns the host path for the per-version user php.ini file.
func RemoveCustomService ¶ added in v0.5.4
RemoveCustomService deletes a custom service config file.
func RemoveSite ¶
RemoveSite removes a site by name from the registry.
func SaveCustomService ¶ added in v0.5.4
func SaveCustomService(svc *CustomService) error
SaveCustomService validates and writes a custom service config to disk.
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 ServiceIsPaused ¶ added in v0.6.0
ServiceIsPaused returns true if the service was manually stopped by the user.
func SetServicePaused ¶ added in v0.6.0
SetServicePaused marks or clears the manual-stop flag for the named service.
func SystemdUserDir ¶
func SystemdUserDir() string
SystemdUserDir returns the systemd user unit directory.
func UpdateCheckFile ¶ added in v0.9.0
func UpdateCheckFile() string
UpdateCheckFile returns the path to the cached update-check state file.
Types ¶
type CustomService ¶ added in v0.5.4
type CustomService struct {
Name string `yaml:"name"`
Image string `yaml:"image"`
Ports []string `yaml:"ports,omitempty"`
Environment map[string]string `yaml:"environment,omitempty"`
DataDir string `yaml:"data_dir,omitempty"`
Exec string `yaml:"exec,omitempty"`
EnvVars []string `yaml:"env_vars,omitempty"`
EnvDetect *EnvDetect `yaml:"env_detect,omitempty"`
SiteInit *SiteInit `yaml:"site_init,omitempty"`
Dashboard string `yaml:"dashboard,omitempty"`
Description string `yaml:"description,omitempty"`
}
CustomService represents a user-defined OCI-based service.
func ListCustomServices ¶ added in v0.5.4
func ListCustomServices() ([]*CustomService, error)
ListCustomServices returns all custom services defined in the services directory.
func LoadCustomService ¶ added in v0.5.4
func LoadCustomService(name string) (*CustomService, error)
LoadCustomService loads a custom service by name from the services directory.
func LoadCustomServiceFromFile ¶ added in v0.5.4
func LoadCustomServiceFromFile(path string) (*CustomService, error)
LoadCustomServiceFromFile parses a CustomService from any YAML file path.
type EnvDetect ¶ added in v0.5.4
type EnvDetect struct {
Key string `yaml:"key"`
ValuePrefix string `yaml:"value_prefix,omitempty"`
}
EnvDetect defines auto-detection rules for `lerd env`.
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"`
Extensions map[string][]string `yaml:"extensions" mapstructure:"extensions"`
} `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) AddExtension ¶ added in v0.5.5
func (c *GlobalConfig) AddExtension(version, ext string)
AddExtension adds ext to the custom extension list for version (no-op if already present).
func (*GlobalConfig) GetExtensions ¶ added in v0.5.5
func (c *GlobalConfig) GetExtensions(version string) []string
GetExtensions returns the custom extensions configured for the given PHP version.
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) RemoveExtension ¶ added in v0.5.5
func (c *GlobalConfig) RemoveExtension(version, ext string)
RemoveExtension removes ext from the custom extension list for 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 FindSiteByDomain ¶ added in v0.1.37
FindSiteByDomain returns the site with the given domain, or an error if not found.
func FindSiteByPath ¶ added in v0.3.0
FindSiteByPath returns the site whose path matches, or an error if not found.
type SiteInit ¶ added in v0.5.4
type SiteInit struct {
// Container to exec into. Defaults to lerd-<service name>.
Container string `yaml:"container,omitempty"`
// Exec is passed to sh -c inside the container.
Exec string `yaml:"exec"`
}
SiteInit defines an optional command to run inside the service container once per project when `lerd env` detects this service. Use it for any per-site setup: creating a database, a user, indexes, etc. The exec string may contain {{site}} and {{site_testing}} placeholders, which are replaced with the project site handle at runtime.
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.