Documentation
¶
Index ¶
- Constants
- Variables
- func CheckHostPortsAvailable(projectName string, ports []string) error
- func GetFreePort(localIPAddr string) (string, error)
- func GetGlobalConfigPath() string
- func GetGlobalDdevDir() string
- func GetGlobalProjectList() map[string]*ProjectInfo
- func GetValidOmitContainers() []string
- func HostPostIsAllocated(port string) string
- func IsValidOmitContainers(containerList []string) bool
- func ReadGlobalConfig() error
- func RemoveProjectInfo(projectName string) error
- func ReservePorts(projectName string, ports []string) error
- func SetProjectAppRoot(projectName string, appRoot string) error
- func ValidateGlobalConfig() error
- func WriteGlobalConfig(config GlobalConfig) error
- type GlobalConfig
- type InvalidOmitContainers
- type ProjectInfo
Constants ¶
const ( DdevSSHAgentContainer = "ddev-ssh-agent" DBAContainer = "dba" )
Container types used with ddev (duplicated from ddevapp, avoiding cross-package cycles)
const DdevGlobalConfigName = "global_config.yaml"
DdevGlobalConfigName is the name of the global config file.
Variables ¶
var DdevNoSentry = os.Getenv("DDEV_NO_SENTRY") == "true"
var ValidOmitContainers = map[string]bool{ DdevSSHAgentContainer: true, DBAContainer: true, }
Functions ¶
func CheckHostPortsAvailable ¶ added in v1.7.0
Check GlobalDdev UsedHostPorts to see if requested ports are available.
func GetFreePort ¶ added in v1.7.0
GetFreePort gets an ephemeral port currently available, but also not listed in DdevGlobalConfig.UsedHostPorts
func GetGlobalConfigPath ¶
func GetGlobalConfigPath() string
GetGlobalConfigPath() gets the path to global config file
func GetGlobalDdevDir ¶
func GetGlobalDdevDir() string
GetGlobalDdevDir returns ~/.ddev, the global caching directory
func GetGlobalProjectList ¶ added in v1.9.0
func GetGlobalProjectList() map[string]*ProjectInfo
GetGlobalProjectList() returns the global project list map
func GetValidOmitContainers ¶
func GetValidOmitContainers() []string
GetValidOmitContainers is a helper function that returns a list of valid containers for OmitContainers.
func HostPostIsAllocated ¶ added in v1.7.0
HostPortIsAllocated returns the project name that has allocated the port, or empty string.
func IsValidOmitContainers ¶
IsValidOmitContainers is a helper function to determine if a the OmitContainers array is valid
func ReadGlobalConfig ¶
func ReadGlobalConfig() error
ReadGlobalConfig() reads the global config file into DdevGlobalConfig
func RemoveProjectInfo ¶ added in v1.8.0
RemoveProjectInfo() removes the ProjectInfo line for a project
func ReservePorts ¶ added in v1.7.0
ReservePorts() adds the ProjectInfo if necessary and assigns the reserved ports
func SetProjectAppRoot ¶ added in v1.9.0
SetProjectAppRoot() sets the approot in the ProjectInfo of global config
func ValidateGlobalConfig ¶
func ValidateGlobalConfig() error
ValidateGlobalConfig validates global config
func WriteGlobalConfig ¶
func WriteGlobalConfig(config GlobalConfig) error
WriteGlobalConfig writes the global config into ~/.ddev.
Types ¶
type GlobalConfig ¶
type GlobalConfig struct {
APIVersion string `yaml:"APIVersion"`
OmitContainers []string `yaml:"omit_containers,flow"`
InstrumentationOptIn bool `yaml:"instrumentation_opt_in"`
LastUsedVersion string `yaml:"last_used_version"`
ProjectList map[string]*ProjectInfo `yaml:"project_info"`
DeveloperMode bool `yaml:"developer_mode,omitempty"`
}
GlobalConfig is the struct defining ddev's global config
var ( // DdevGlobalConfig is the currently active global configuration struct DdevGlobalConfig GlobalConfig )
type InvalidOmitContainers ¶
type InvalidOmitContainers error
type ProjectInfo ¶ added in v1.7.0
type ProjectInfo struct {
AppRoot string `yaml:"approot"`
UsedHostPorts []string `yaml:"used_host_ports,omitempty,flow"`
}
func GetProject ¶ added in v1.9.0
func GetProject(projectName string) *ProjectInfo
GetProject returns a project given name provided, or nil if not found.