Documentation
¶
Index ¶
- Constants
- Variables
- func CheckForConf(confPath string) (string, error)
- func CheckRouterPorts() error
- func Cleanup(app *DdevApp) error
- func CreateAppTable() *uitable.Table
- func GetActiveAppRoot(siteName string) (string, error)
- func GetRouterStatus() string
- func GetValidAppTypes() []string
- func IsValidAppType(apptype string) bool
- func PrepDdevDirectory(dir string) error
- func RenderAppRow(table *uitable.Table, row map[string]interface{})
- func RenderHomeRootedDir(path string) string
- func RenderRouterStatus() string
- func RouterComposeYAMLPath() string
- func StartDdevRouter() error
- func StopRouterIfNoContainers() error
- func WriteDrushConfig(drushConfig *DrushConfig, filePath string) error
- func WriteWordpressConfig(wordpressConfig *WordpressConfig, filePath string) error
- type AppTypeFuncs
- type Command
- type DdevApp
- func (app *DdevApp) AddHostsEntry() error
- func (app *DdevApp) AppConfDir() string
- func (app *DdevApp) ComposeFiles() []string
- func (app *DdevApp) ConfigExists() bool
- func (app *DdevApp) ConfigFileOverrideAction() error
- func (app *DdevApp) CreateSettingsFile() (string, error)
- func (app *DdevApp) Describe() (map[string]interface{}, error)
- func (app *DdevApp) DetectAppType() string
- func (app *DdevApp) DetermineSettingsPathLocation() (string, error)
- func (app *DdevApp) DockerComposeYAMLPath() string
- func (app *DdevApp) DockerEnv()
- func (app *DdevApp) Down(removeData bool) error
- func (app *DdevApp) Exec(service string, cmd ...string) (string, string, error)
- func (app *DdevApp) ExecWithTty(service string, cmd ...string) error
- func (app *DdevApp) FindContainerByType(containerType string) (docker.APIContainers, error)
- func (app *DdevApp) GetAppRoot() string
- func (app *DdevApp) GetConfigPath(filename string) string
- func (app DdevApp) GetDocroot() string
- func (app *DdevApp) GetHTTPSURL() string
- func (app *DdevApp) GetHTTPURL() string
- func (app *DdevApp) GetHookDefaultComments() []byte
- func (app *DdevApp) GetHostname() string
- func (app *DdevApp) GetName() string
- func (app *DdevApp) GetPhpVersion() string
- func (app *DdevApp) GetProvider() (Provider, error)
- func (app *DdevApp) GetType() string
- func (app *DdevApp) GetUploadDir() string
- func (app *DdevApp) HostName() string
- func (app *DdevApp) Import() error
- func (app *DdevApp) ImportDB(imPath string, extPath string) error
- func (app *DdevApp) ImportFiles(imPath string, extPath string) error
- func (app *DdevApp) Init(basePath string) error
- func (app *DdevApp) Logs(service string, follow bool, timestamps bool, tailLines string) error
- func (app *DdevApp) PostConfigAction() error
- func (app *DdevApp) PostImportDBAction() error
- func (app *DdevApp) ProcessHooks(hookName string) error
- func (app *DdevApp) PromptForConfig() error
- func (app *DdevApp) ReadConfig() error
- func (app *DdevApp) RenderComposeYAML() (string, error)
- func (app *DdevApp) SetApptypeSettingsPaths()
- func (app *DdevApp) SiteStatus() string
- func (app *DdevApp) Start() error
- func (app *DdevApp) Stop() error
- func (app *DdevApp) ValidateConfig() error
- func (app *DdevApp) Wait(containerTypes ...string) error
- func (app *DdevApp) WarnIfConfigReplace()
- func (app *DdevApp) WriteConfig() error
- func (app *DdevApp) WriteDockerComposeConfig() error
- type DefaultProvider
- func (p *DefaultProvider) GetBackup(backupType string) (fileLocation string, importPath string, err error)
- func (p *DefaultProvider) Init(app *DdevApp) error
- func (p *DefaultProvider) PromptForConfig() error
- func (p *DefaultProvider) Read(configPath string) error
- func (p *DefaultProvider) Validate() error
- func (p *DefaultProvider) ValidateField(field, value string) error
- func (p *DefaultProvider) Write(configPath string) error
- type DrupalSettings
- type DrushConfig
- type PantheonProvider
- func (p *PantheonProvider) GetBackup(backupType string) (fileLocation string, importPath string, err error)
- func (p *PantheonProvider) GetEnvironments() (pantheon.EnvironmentList, error)
- func (p *PantheonProvider) Init(app *DdevApp) error
- func (p *PantheonProvider) PromptForConfig() error
- func (p *PantheonProvider) Read(configPath string) error
- func (p *PantheonProvider) SetSiteNameAndEnv(environment string)
- func (p *PantheonProvider) Validate() error
- func (p *PantheonProvider) ValidateField(field, value string) error
- func (p *PantheonProvider) Write(configPath string) error
- type Provider
- type WordpressConfig
Constants ¶
const CurrentAppVersion = "1"
CurrentAppVersion sets the current YAML config file version. We're not doing anything with AppVersion, so just default it to 1 for now.
const DDevComposeTemplate = `` /* 2600-byte string literal not displayed */
DDevComposeTemplate is used to create the main docker-compose.yaml file for a ddev site.
const DdevDefaultPHPVersion = "7.1"
DdevDefaultPHPVersion is the default PHP version, overridden by $DDEV_PHP_VERSION
const DdevDefaultRouterHTTPPort = "80"
DdevDefaultRouterHTTPPort is the starting router port, 80
const DdevDefaultRouterHTTPSPort = "443"
DdevDefaultRouterHTTPSPort is the starting https router port, 443
const DdevFileSignature = "#ddev-generated"
DdevFileSignature is the text we use to detect whether a settings file is managed by us. If this string is found, we assume we can replace/update the file.
const DdevRouterTemplate = `` /* 392-byte string literal not displayed */
DdevRouterTemplate is the template for the generic router container.
const DefaultProviderName = "default"
DefaultProviderName contains the name of the default provider which will be used if one is not otherwise specified.
const Drupal7Hooks = `
# - exec: "drush cc all"`
Drupal7Hooks adds a d7-specific hooks example for post-import-db
const Drupal8Hooks = `
# - exec: "drush cr"`
Drupal8Hooks adds a d8-specific hooks example for post-import-db
const HookTemplate = `` /* 301-byte string literal not displayed */
HookTemplate is used to add example hooks usage
const RouterProjectName = "ddev-router"
RouterProjectName is the "machine name" of the router docker-compose
const SiteConfigMissing = ".ddev/config.yaml missing"
SiteConfigMissing defines the string used to denote when a site is missing its .ddev/config.yml file.
const SiteDirMissing = "app directory missing"
SiteDirMissing defines the string used to denote when a site is missing its application directory.
const SiteNotFound = "not found"
SiteNotFound defines the string used to denote a site where the containers were not found/do not exist.
const SiteRunning = "running"
SiteRunning defines the string used to denote running sites.
const SiteStopped = "stopped"
SiteStopped defines the string used to denote when a site is in the stopped state.
const Typo3Hooks = `
# - exec: "echo database was loaded"`
Typo3Hooks adds a typo3-specific hooks example for post-import-db
Variables ¶
var SequelproTemplate = `` /* 1773-byte string literal not displayed */
SequelproTemplate is the template for Sequelpro config.
Functions ¶
func CheckForConf ¶ added in v0.11.0
CheckForConf checks for a config.yaml at the cwd or parent dirs.
func CheckRouterPorts ¶ added in v0.11.0
func CheckRouterPorts() error
CheckRouterPorts tries to connect to the ports the router will use as a heuristic to find out if they're available for docker to bind to. Returns an error if either one results in a successful connection.
func Cleanup ¶ added in v0.11.0
Cleanup will remove ddev containers and volumes even if docker-compose.yml has been deleted.
func CreateAppTable ¶ added in v0.11.0
CreateAppTable will create a new app table for describe and list output
func GetActiveAppRoot ¶ added in v0.11.0
GetActiveAppRoot returns the fully rooted directory of the active app, or an error
func GetRouterStatus ¶ added in v0.11.0
func GetRouterStatus() string
GetRouterStatus outputs router status and warning if not running or healthy, as applicable.
func GetValidAppTypes ¶ added in v0.11.0
func GetValidAppTypes() []string
GetValidAppTypes returns the valid apptype keys from the appTypeMatrix
func IsValidAppType ¶ added in v0.11.0
IsValidAppType checks to see if the given apptype string is a valid configured apptype.
func PrepDdevDirectory ¶
PrepDdevDirectory creates a .ddev directory in the current working directory
func RenderAppRow ¶ added in v0.11.0
RenderAppRow will add an application row to an existing table for describe and list output.
func RenderHomeRootedDir ¶ added in v0.11.0
RenderHomeRootedDir shortens a directory name to replace homedir with ~
func RenderRouterStatus ¶ added in v0.11.0
func RenderRouterStatus() string
RenderRouterStatus returns a user-friendly string showing router-status
func RouterComposeYAMLPath ¶ added in v0.11.0
func RouterComposeYAMLPath() string
RouterComposeYAMLPath returns the full filepath to the routers docker-compose yaml file.
func StartDdevRouter ¶ added in v0.11.0
func StartDdevRouter() error
StartDdevRouter ensures the router is running.
func StopRouterIfNoContainers ¶ added in v0.12.0
func StopRouterIfNoContainers() error
StopRouterIfNoContainers stops the router if there are no ddev containers running.
func WriteDrushConfig ¶ added in v0.11.0
func WriteDrushConfig(drushConfig *DrushConfig, filePath string) error
WriteDrushConfig writes out a drush config based on passed-in values.
func WriteWordpressConfig ¶ added in v0.11.0
func WriteWordpressConfig(wordpressConfig *WordpressConfig, filePath string) error
WriteWordpressConfig dynamically produces valid wp-config.php file by combining a configuration object with a data-driven template.
Types ¶
type AppTypeFuncs ¶ added in v0.11.0
type AppTypeFuncs struct {
// contains filtered or unexported fields
}
AppTypeFuncs struct defines the functions that can be called (if populated) for a given appType.
type Command ¶
type Command struct {
Exec string `yaml:"exec,omitempty"`
ExecHost string `yaml:"exec-host,omitempty"`
}
Command defines commands to be run as pre/post hooks
type DdevApp ¶ added in v0.11.0
type DdevApp struct {
APIVersion string `yaml:"APIVersion"`
Name string `yaml:"name"`
Type string `yaml:"type"`
Docroot string `yaml:"docroot"`
PHPVersion string `yaml:"php_version"`
WebImage string `yaml:"webimage"`
DBImage string `yaml:"dbimage"`
DBAImage string `yaml:"dbaimage"`
RouterHTTPPort string `yaml:"router_http_port"`
RouterHTTPSPort string `yaml:"router_https_port"`
ConfigPath string `yaml:"-"`
AppRoot string `yaml:"-"`
Platform string `yaml:"-"`
Provider string `yaml:"provider,omitempty"`
DataDir string `yaml:"-"`
ImportDir string `yaml:"-"`
SiteSettingsPath string `yaml:"-"`
SiteLocalSettingsPath string `yaml:"-"`
Commands map[string][]Command `yaml:"hooks,omitempty"`
// contains filtered or unexported fields
}
DdevApp is the struct that represents a ddev app, mostly its config from config.yaml.
func GetActiveApp ¶ added in v0.11.0
GetActiveApp returns the active App based on the current working directory or running siteName provided. To use the current working directory, siteName should be ""
func GetApps ¶ added in v0.11.0
func GetApps() []*DdevApp
GetApps returns an array of ddev applications.
func NewApp ¶ added in v0.11.0
NewApp creates a new DdevApp struct with defaults set and overridden by any existing config.yml.
func (*DdevApp) AddHostsEntry ¶ added in v0.11.0
AddHostsEntry will add the site URL to the host's /etc/hosts.
func (*DdevApp) AppConfDir ¶ added in v0.11.0
AppConfDir returns the full path to the app's .ddev configuration directory
func (*DdevApp) ComposeFiles ¶ added in v0.11.0
ComposeFiles returns a list of compose files for a project.
func (*DdevApp) ConfigExists ¶ added in v0.11.0
ConfigExists determines if a ddev config file exists for this application.
func (*DdevApp) ConfigFileOverrideAction ¶ added in v0.12.0
ConfigFileOverrideAction gives a chance for an apptype to override any element of config.yaml that it needs to.
func (*DdevApp) CreateSettingsFile ¶ added in v0.11.0
CreateSettingsFile creates the settings file (like settings.php) for the provided app is the apptype has a settingsCreator function.
func (*DdevApp) Describe ¶ added in v0.11.0
Describe returns a map which provides detailed information on services associated with the running site.
func (*DdevApp) DetectAppType ¶ added in v0.11.0
DetectAppType calls each apptype's detector until it finds a match, or returns 'php' as a last resort.
func (*DdevApp) DetermineSettingsPathLocation ¶ added in v0.11.0
DetermineSettingsPathLocation figures out the path to the settings file for an app based on the contents/existence of app.SiteSettingsPath and app.SiteLocalSettingsPath.
func (*DdevApp) DockerComposeYAMLPath ¶ added in v0.11.0
DockerComposeYAMLPath returns the absolute path to where the docker-compose.yaml should exist for this app.
func (*DdevApp) DockerEnv ¶ added in v0.11.0
func (app *DdevApp) DockerEnv()
DockerEnv sets environment variables for a docker-compose run.
func (*DdevApp) Down ¶ added in v0.11.0
Down stops the docker containers for the project in current directory.
func (*DdevApp) Exec ¶ added in v0.11.0
Exec executes a given command in the container of given type without allocating a pty Returns ComposeCmd results of stdout, stderr, err
func (*DdevApp) ExecWithTty ¶ added in v0.11.0
ExecWithTty executes a given command in the container of given type. It allocates a pty for interactive work.
func (*DdevApp) FindContainerByType ¶ added in v0.11.0
FindContainerByType will find a container for this site denoted by the containerType if it is available.
func (*DdevApp) GetAppRoot ¶ added in v0.11.0
GetAppRoot return the full path from root to the app directory
func (*DdevApp) GetConfigPath ¶ added in v0.11.0
GetConfigPath returns the path to an application config file specified by filename.
func (DdevApp) GetDocroot ¶ added in v0.11.0
GetDocroot returns the docroot path for ddev app
func (*DdevApp) GetHTTPSURL ¶ added in v0.12.0
GetHTTPSURL returns the HTTPS URL for an app.
func (*DdevApp) GetHTTPURL ¶ added in v0.12.0
GetHTTPURL returns the HTTP URL for an app.
func (*DdevApp) GetHookDefaultComments ¶ added in v0.11.0
GetHookDefaultComments gets the actual text of the config.yaml hook suggestions for a given apptype
func (*DdevApp) GetHostname ¶ added in v0.11.0
GetHostname returns the hostname of the app.
func (*DdevApp) GetPhpVersion ¶ added in v0.12.0
GetPhpVersion returns the app's php version
func (*DdevApp) GetProvider ¶ added in v0.11.0
GetProvider returns a pointer to the provider instance interface.
func (*DdevApp) GetType ¶ added in v0.11.0
GetType returns the application type as a (lowercase) string
func (*DdevApp) GetUploadDir ¶ added in v0.11.0
GetUploadDir returns the upload (public files) directory for the given app
func (*DdevApp) Import ¶ added in v0.11.0
Import performs an import from the a configured provider plugin, if one exists.
func (*DdevApp) ImportDB ¶ added in v0.11.0
ImportDB takes a source sql dump and imports it to an active site's database container.
func (*DdevApp) ImportFiles ¶ added in v0.11.0
ImportFiles takes a source directory or archive and copies to the uploaded files directory of a given app.
func (*DdevApp) Init ¶ added in v0.11.0
Init populates DdevApp config based on the current working directory. It does not start the containers.
func (*DdevApp) Logs ¶ added in v0.11.0
Logs returns logs for a site's given container. See docker.LogsOptions for more information about valid tailLines values.
func (*DdevApp) PostConfigAction ¶ added in v0.12.0
PostConfigAction gives a chance for an apptype to override do something at the end of ddev config.
func (*DdevApp) PostImportDBAction ¶ added in v0.11.0
PostImportDBAction calls each apptype's detector until it finds a match, or returns 'php' as a last resort.
func (*DdevApp) ProcessHooks ¶ added in v0.11.0
ProcessHooks executes commands defined in a Command
func (*DdevApp) PromptForConfig ¶ added in v0.11.0
PromptForConfig goes through a set of prompts to receive user input and generate an Config struct.
func (*DdevApp) ReadConfig ¶ added in v0.11.0
ReadConfig reads app configuration from a specified location on disk, falling back to defaults for config values not defined in the read config file.
func (*DdevApp) RenderComposeYAML ¶ added in v0.11.0
RenderComposeYAML renders the contents of docker-compose.yaml.
func (*DdevApp) SetApptypeSettingsPaths ¶ added in v0.11.0
func (app *DdevApp) SetApptypeSettingsPaths()
SetApptypeSettingsPaths chooses and sets the settings.php/settings.local.php and related paths for a given app.
func (*DdevApp) SiteStatus ¶ added in v0.11.0
SiteStatus returns the current status of an application determined from web and db service health.
func (*DdevApp) ValidateConfig ¶ added in v0.11.0
ValidateConfig ensures the configuration meets ddev's requirements.
func (*DdevApp) WarnIfConfigReplace ¶ added in v0.11.0
func (app *DdevApp) WarnIfConfigReplace()
WarnIfConfigReplace just messages user about whether config is being replaced or created
func (*DdevApp) WriteConfig ¶ added in v0.11.0
WriteConfig writes the app configuration into the .ddev folder.
func (*DdevApp) WriteDockerComposeConfig ¶ added in v0.11.0
WriteDockerComposeConfig writes a docker-compose.yaml to the app configuration directory.
type DefaultProvider ¶
type DefaultProvider struct{}
DefaultProvider provides a no-op for the provider plugin interface methods.
func (*DefaultProvider) GetBackup ¶
func (p *DefaultProvider) GetBackup(backupType string) (fileLocation string, importPath string, err error)
GetBackup provides a no-op for the GetBackup operation.
func (*DefaultProvider) Init ¶
func (p *DefaultProvider) Init(app *DdevApp) error
Init provides a no-op for the Init operation.
func (*DefaultProvider) PromptForConfig ¶ added in v0.9.4
func (p *DefaultProvider) PromptForConfig() error
PromptForConfig provides a no-op for the Config operation.
func (*DefaultProvider) Read ¶
func (p *DefaultProvider) Read(configPath string) error
Read provides a no-op for the Read operation.
func (*DefaultProvider) Validate ¶
func (p *DefaultProvider) Validate() error
Validate always succeeds, because the default provider is a fine provider.
func (*DefaultProvider) ValidateField ¶
func (p *DefaultProvider) ValidateField(field, value string) error
ValidateField provides a no-op for the ValidateField operation.
func (*DefaultProvider) Write ¶
func (p *DefaultProvider) Write(configPath string) error
Write provides a no-op for the Write operation.
type DrupalSettings ¶ added in v0.11.0
type DrupalSettings struct {
DeployName string
DeployURL string
DatabaseName string
DatabaseUsername string
DatabasePassword string
DatabaseHost string
DatabaseDriver string
DatabasePort string
DatabasePrefix string
HashSalt string
IsDrupal8 bool
Signature string
}
DrupalSettings encapsulates all the configurations for a Drupal site.
func NewDrupalSettings ¶ added in v0.11.0
func NewDrupalSettings() *DrupalSettings
NewDrupalSettings produces a DrupalSettings object with default.
type DrushConfig ¶ added in v0.11.0
DrushConfig encapsulates configuration for a drush settings file.
func NewDrushConfig ¶ added in v0.11.0
func NewDrushConfig() *DrushConfig
NewDrushConfig produces a DrushConfig object with default.
type PantheonProvider ¶
type PantheonProvider struct {
ProviderType string `yaml:"provider"`
Sitename string `yaml:"site"`
EnvironmentName string `yaml:"environment"`
// contains filtered or unexported fields
}
PantheonProvider provides pantheon-specific import functionality.
func (*PantheonProvider) GetBackup ¶
func (p *PantheonProvider) GetBackup(backupType string) (fileLocation string, importPath string, err error)
GetBackup will download the most recent backup specified by backupType. Valid values for backupType are "database" or "files".
func (*PantheonProvider) GetEnvironments ¶
func (p *PantheonProvider) GetEnvironments() (pantheon.EnvironmentList, error)
GetEnvironments will return a list of environments for the currently configured upstream pantheon site.
func (*PantheonProvider) Init ¶
func (p *PantheonProvider) Init(app *DdevApp) error
Init handles loading data from saved config.
func (*PantheonProvider) PromptForConfig ¶ added in v0.9.4
func (p *PantheonProvider) PromptForConfig() error
PromptForConfig provides interactive configuration prompts when running `ddev config pantheon`
func (*PantheonProvider) Read ¶
func (p *PantheonProvider) Read(configPath string) error
Read pantheon provider configuration from a specified location on disk.
func (*PantheonProvider) SetSiteNameAndEnv ¶ added in v0.9.4
func (p *PantheonProvider) SetSiteNameAndEnv(environment string)
SetSiteNameAndEnv sets the environment of the provider (dev/test/live)
func (*PantheonProvider) Validate ¶
func (p *PantheonProvider) Validate() error
Validate ensures that the current configuration is valid (i.e. the configured pantheon site/environment exists)
func (*PantheonProvider) ValidateField ¶
func (p *PantheonProvider) ValidateField(field, value string) error
ValidateField provides field level validation for config settings. This is used any time a field is set via `ddev config` on the primary app config, and allows provider plugins to have additional validation for top level config settings.
func (*PantheonProvider) Write ¶
func (p *PantheonProvider) Write(configPath string) error
Write the pantheon provider configuration to a spcified location on disk.
type Provider ¶
type Provider interface {
Init(app *DdevApp) error
ValidateField(string, string) error
PromptForConfig() error
Write(string) error
Read(string) error
Validate() error
GetBackup(string) (fileLocation string, importPath string, err error)
}
Provider is the interface which all provider plugins must implement.
type WordpressConfig ¶ added in v0.11.0
type WordpressConfig struct {
WPGeneric bool
DeployName string
DeployURL string
DatabaseName string
DatabaseUsername string
DatabasePassword string
DatabaseHost string
AuthKey string
SecureAuthKey string
LoggedInKey string
NonceKey string
AuthSalt string
SecureAuthSalt string
LoggedInSalt string
NonceSalt string
Docroot string
TablePrefix string
Signature string
}
WordpressConfig encapsulates all the configurations for a WordPress site.
func NewWordpressConfig ¶ added in v0.11.0
func NewWordpressConfig() *WordpressConfig
NewWordpressConfig produces a WordpressConfig object with defaults.