Documentation ¶
Index ¶
- Constants
- Variables
- func CheckHostPortsAvailable(projectName string, ports []string) error
- func EnsureGlobalConfig()
- func GetCAROOT() string
- func GetDDEVBinDir() string
- func GetDockerComposePath() (string, error)
- func GetFreePort(localIPAddr string) (string, error)
- func GetGlobalConfigPath() string
- func GetGlobalDdevDir() string
- func GetGlobalProjectList() map[string]*ProjectInfo
- func GetMutagenDataDirectory() string
- func GetMutagenPath() string
- func GetRequiredDockerComposeVersion() string
- func GetRouterURL() string
- func GetTableStyle() string
- func GetValidOmitContainers() []string
- func HostPostIsAllocated(port string) string
- func IsInternetActive() bool
- func IsValidOmitContainers(containerList []string) bool
- func IsValidTableStyle(style string) bool
- func IsValidXdebugIDELocation(loc 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 ValidTableStyleList() []string
- func ValidateGlobalConfig() error
- func WriteGlobalConfig(config GlobalConfig) error
- type GlobalConfig
- type InvalidOmitContainers
- type MessagesConfig
- type ProjectInfo
- type RemoteConfig
- type RemoteConfigRemote
Constants ¶
const ( DdevSSHAgentContainer = "ddev-ssh-agent" DdevRouterContainer = "ddev-router" XdebugIDELocationContainer = "container" XdebugIDELocationWSL2 = "wsl2" )
Container types used with ddev (duplicated from ddevapp, avoiding cross-package cycles)
const DdevGithubOrg = "ddev"
const DdevGlobalConfigName = "global_config.yaml"
DdevGlobalConfigName is the name of the global config file.
Variables ¶
var ( FormatOptionsDefault = table.FormatOptions{ Header: text.FormatUpper, Row: text.FormatDefault, } DdevDefaultStyle = table.Style{ Name: "StyleLight", Box: table.StyleBoxLight, Color: table.ColorOptionsDefault, Format: FormatOptionsDefault, HTML: table.DefaultHTMLOptions, Options: OptionsSeparateRows, Title: table.TitleOptionsDefault, } DdevStyleBold = table.Style{ Name: "StyleBold", Box: table.StyleBoxBold, Color: table.ColorOptionsDefault, Format: FormatOptionsDefault, HTML: table.DefaultHTMLOptions, Options: table.OptionsDefault, Title: table.TitleOptionsDefault, } DdevStyleColoredBright = table.Style{ Name: "StyleColoredBright", Box: table.StyleBoxDefault, Color: table.ColorOptionsBright, Format: FormatOptionsDefault, HTML: table.DefaultHTMLOptions, Options: table.OptionsNoBordersAndSeparators, Title: table.TitleOptionsDark, } )
var DdevDebug = (os.Getenv("DDEV_DEBUG") == "true")
DdevDebug is set to true if the env var is set
var DdevNoInstrumentation = os.Getenv("DDEV_NO_INSTRUMENTATION") == "true"
DdevNoInstrumentation is set to true if the env var is set
var DdevVerbose = (os.Getenv("DDEV_VERBOSE") == "true")
DdevVerbose is set to true if the env var is set
var DockerComposeVersion = ""
DockerComposeVersion is filled with the version we find for docker-compose
var IsInternetActiveAlreadyChecked = false
IsInternetActiveAlreadyChecked just flags whether it's been checked
var IsInternetActiveNetResolver interface { LookupHost(ctx context.Context, host string) (addrs []string, err error) } = net.DefaultResolver
IsInternetActiveNetResolver wraps the standard DNS resolver. In order to override net.DefaultResolver with a stub, we have to define an interface on our own since there is none from the standard library.
var IsInternetActiveResult = false
IsInternetActiveResult is the result of the check
var OptionsSeparateRows = table.Options{ DrawBorder: true, SeparateColumns: true, SeparateFooter: true, SeparateHeader: true, SeparateRows: true, }
var StyleMap = map[string]table.Style{ "default": DdevDefaultStyle, "bold": DdevStyleBold, "bright": DdevStyleColoredBright, }
StyleMap give the list of available styles
var ValidOmitContainers = map[string]bool{ DdevRouterContainer: true, DdevSSHAgentContainer: true, }
ValidOmitContainers is the valid omit's that can be done in for a project
var ValidXdebugIDELocations = []string{XdebugIDELocationContainer, XdebugIDELocationWSL2, ""}
Functions ¶
func CheckHostPortsAvailable ¶
CheckHostPortsAvailable checks GlobalDdev UsedHostPorts to see if requested ports are available.
func EnsureGlobalConfig ¶ added in v1.22.0
func EnsureGlobalConfig()
Make sure the global configuration has been initialized
func GetDDEVBinDir ¶
func GetDDEVBinDir() string
GetDDEVBinDir returns the directory of the mutagen config and binary
func GetDockerComposePath ¶
GetDockerComposePath gets the full path to the docker-compose binary Normally this is the one that has been downloaded to ~/.ddev/bin, but if UseDockerComposeFromPath, then it will be whatever if found in $PATH
func GetFreePort ¶
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 ¶
func GetGlobalProjectList() map[string]*ProjectInfo
GetGlobalProjectList returns the global project list map
func GetMutagenDataDirectory ¶
func GetMutagenDataDirectory() string
GetMutagenDataDirectory gets the full path to the MUTAGEN_DATA_DIRECTORY
func GetMutagenPath ¶
func GetMutagenPath() string
GetMutagenPath gets the full path to the mutagen binary
func GetRequiredDockerComposeVersion ¶
func GetRequiredDockerComposeVersion() string
GetRequiredDockerComposeVersion returns the version of docker-compose we need based on the compiled version, or overrides in globalconfig, like required_docker_compose_version and use_docker_compose_from_path In the case of UseDockerComposeFromPath there is no required version, so this will return empty string.
func GetTableStyle ¶
func GetTableStyle() string
GetTableStyle returns the configured (string) table style
func GetValidOmitContainers ¶
func GetValidOmitContainers() []string
GetValidOmitContainers is a helper function that returns a list of valid containers for OmitContainers.
func HostPostIsAllocated ¶
HostPostIsAllocated returns the project name that has allocated the port, or empty string.
func IsInternetActive ¶
func IsInternetActive() bool
IsInternetActive checks to see if we have a viable internet connection. It just tries a quick DNS query. This requires that the named record be query-able. This check will only be made once per command run.
func IsValidOmitContainers ¶
IsValidOmitContainers is a helper function to determine if the OmitContainers array is valid
func IsValidTableStyle ¶
IsValidTableStyle checks to see if the table style is valid
func IsValidXdebugIDELocation ¶
IsValidXdebugIDELocation limits the choices for XdebugIDELocation
func ReadGlobalConfig ¶
func ReadGlobalConfig() error
ReadGlobalConfig reads the global config file into DdevGlobalConfig Or creates the file
func RemoveProjectInfo ¶
RemoveProjectInfo removes the ProjectInfo line for a project
func ReservePorts ¶
ReservePorts adds the ProjectInfo if necessary and assigns the reserved ports
func SetProjectAppRoot ¶
SetProjectAppRoot sets the approot in the ProjectInfo of global config
func ValidTableStyleList ¶
func ValidTableStyleList() []string
ValidTableStyleList returns an array of valid styles
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 { OmitContainersGlobal []string `yaml:"omit_containers,flow"` PerformanceMode configTypes.PerformanceMode `yaml:"performance_mode"` InstrumentationOptIn bool `yaml:"instrumentation_opt_in"` InstrumentationQueueSize int `yaml:"instrumentation_queue_size,omitempty"` InstrumentationReportingInterval time.Duration `yaml:"instrumentation_reporting_interval,omitempty"` RouterBindAllInterfaces bool `yaml:"router_bind_all_interfaces"` InternetDetectionTimeout int64 `yaml:"internet_detection_timeout_ms"` DeveloperMode bool `yaml:"developer_mode,omitempty"` InstrumentationUser string `yaml:"instrumentation_user,omitempty"` LastStartedVersion string `yaml:"last_started_version"` UseHardenedImages bool `yaml:"use_hardened_images"` UseLetsEncrypt bool `yaml:"use_letsencrypt"` LetsEncryptEmail string `yaml:"letsencrypt_email"` AutoRestartContainers bool `yaml:"auto_restart_containers"` FailOnHookFailGlobal bool `yaml:"fail_on_hook_fail"` WebEnvironment []string `yaml:"web_environment"` DisableHTTP2 bool `yaml:"disable_http2"` TableStyle string `yaml:"table_style"` SimpleFormatting bool `yaml:"simple_formatting"` RequiredDockerComposeVersion string `yaml:"required_docker_compose_version,omitempty"` UseDockerComposeFromPath bool `yaml:"use_docker_compose_from_path,omitempty"` MkcertCARoot string `yaml:"mkcert_caroot"` ProjectTldGlobal string `yaml:"project_tld"` XdebugIDELocation string `yaml:"xdebug_ide_location"` NoBindMounts bool `yaml:"no_bind_mounts"` Router string `yaml:"router"` WSL2NoWindowsHostsMgt bool `yaml:"wsl2_no_windows_hosts_mgt"` RouterHTTPPort string `yaml:"router_http_port"` RouterHTTPSPort string `yaml:"router_https_port"` Messages MessagesConfig `yaml:"messages,omitempty"` RemoteConfig RemoteConfig `yaml:"remote_config,omitempty"` ProjectList map[string]*ProjectInfo `yaml:"project_info"` }
GlobalConfig is the struct defining ddev's global config
var ( // DdevGlobalConfig is the currently active global configuration struct DdevGlobalConfig GlobalConfig )
func (*GlobalConfig) GetPerformanceMode ¶ added in v1.22.0
func (c *GlobalConfig) GetPerformanceMode() types.PerformanceMode
GetPerformanceMode returns the performance mode config respecting defaults.
func (*GlobalConfig) IsMutagenEnabled ¶ added in v1.22.0
func (c *GlobalConfig) IsMutagenEnabled() bool
IsMutagenEnabled returns true if Mutagen is enabled.
func (*GlobalConfig) IsNFSMountEnabled ¶ added in v1.22.0
func (c *GlobalConfig) IsNFSMountEnabled() bool
IsNFSMountEnabled returns true if NFS is enabled.
func (*GlobalConfig) IsTraefikRouter ¶ added in v1.22.0
func (c *GlobalConfig) IsTraefikRouter() bool
IsTraefikRouter returns true if the router is traefik
func (*GlobalConfig) SetPerformanceMode ¶ added in v1.22.0
func (c *GlobalConfig) SetPerformanceMode(performanceMode string) *GlobalConfig
SetPerformanceMode sets the performance mode config.
type InvalidOmitContainers ¶
type InvalidOmitContainers error
type MessagesConfig ¶ added in v1.22.0
type MessagesConfig struct {
TickerInterval int `yaml:"ticker_interval,omitempty"`
}
MessagesConfig is the struct defining the messages config.
type ProjectInfo ¶
type ProjectInfo struct { AppRoot string `yaml:"approot"` UsedHostPorts []string `yaml:"used_host_ports,omitempty,flow"` }
func GetProject ¶
func GetProject(projectName string) *ProjectInfo
GetProject returns a project given name provided, or nil if not found.
type RemoteConfig ¶ added in v1.22.0
type RemoteConfig struct { UpdateInterval int `yaml:"update_interval,omitempty"` Remote RemoteConfigRemote `yaml:"remote,omitempty"` }
RemoteConfig is the struct defining the remote-config config.
type RemoteConfigRemote ¶ added in v1.22.0
type RemoteConfigRemote struct { Owner string `yaml:"owner,omitempty"` Repo string `yaml:"repo,omitempty"` Ref string `yaml:"ref,omitempty"` Filepath string `yaml:"filepath,omitempty"` }
RemoteConfigRemote is the struct defining the source of the remote-config.