Documentation
¶
Index ¶
- Constants
- Variables
- func DetermineAppType(basePath string) (string, error)
- func IsAllowedAppType(appType string) bool
- func PrepDdevDirectory(dir string) error
- type Command
- type Config
- func (c *Config) ConfigExists() bool
- func (c *Config) DockerComposeYAMLPath() string
- func (c *Config) GetPath(filename string) string
- func (c *Config) GetProvider() (Provider, error)
- func (c *Config) Hostname() string
- func (c *Config) PromptForConfig() error
- func (c *Config) Read() error
- func (c *Config) RenderComposeYAML() (string, error)
- func (c *Config) Validate() error
- func (c *Config) WarnIfConfigReplace()
- func (c *Config) Write() error
- func (c *Config) WriteDockerComposeConfig() error
- type DefaultProvider
- func (p *DefaultProvider) GetBackup(backupType string) (fileLocation string, importPath string, err error)
- func (p *DefaultProvider) Init(config *Config) 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 PantheonProvider
- func (p *PantheonProvider) GetBackup(backupType string) (fileLocation string, importPath string, err error)
- func (p *PantheonProvider) GetEnvironments() (pantheon.EnvironmentList, error)
- func (p *PantheonProvider) Init(config *Config) 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
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 = `` /* 2353-byte string literal not displayed */
DDevComposeTemplate is used to create the main docker-compose.yaml file for a ddev site.
const DDevDefaultPlatform = "local"
DDevDefaultPlatform defines the DDev Platform. It's just hardcoded for now, but should be adjusted as we add more platforms.
const DDevTLD = "ddev.local"
DDevTLD defines the tld to use for DDev site URLs.
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 WordPressHooks = `` /* 171-byte string literal not displayed */
WordPressHooks adds a wp-specific hooks example for post-import-db
Variables ¶
var AllowedAppTypes = []string{"drupal7", "drupal8", "wordpress"}
AllowedAppTypes lists the types of site/app that can be used.
Functions ¶
func DetermineAppType ¶ added in v0.9.4
DetermineAppType uses some predetermined file checks to determine if a local app is of any of the known types
func IsAllowedAppType ¶
IsAllowedAppType determines if a given string exists in the AllowedAppTypes slice.
func PrepDdevDirectory ¶
PrepDdevDirectory creates a .ddev directory in the current working directory
Types ¶
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 Config ¶
type Config struct {
APIVersion string `yaml:"APIVersion"`
Name string `yaml:"name"`
AppType string `yaml:"type"`
Docroot string `yaml:"docroot"`
WebImage string `yaml:"webimage"`
DBImage string `yaml:"dbimage"`
DBAImage string `yaml:"dbaimage"`
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
}
Config defines the yaml config file format for ddev applications
func NewConfig ¶
NewConfig creates a new Config struct with defaults set and overridden by any existing config.yml.
func (*Config) ConfigExists ¶
ConfigExists determines if a ddev config file exists for this application.
func (*Config) DockerComposeYAMLPath ¶
DockerComposeYAMLPath returns the absolute path to where the docker-compose.yaml should exist for this app configuration.
func (*Config) GetPath ¶
GetPath returns the path to an application config file specified by filename.
func (*Config) GetProvider ¶
GetProvider returns a pointer to the provider instance interface.
func (*Config) PromptForConfig ¶ added in v0.9.4
PromptForConfig goes through a set of prompts to receive user input and generate an Config struct.
func (*Config) Read ¶
Read app configuration from a specified location on disk, falling back to defaults for config values not defined in the read config file.
func (*Config) RenderComposeYAML ¶
RenderComposeYAML renders the contents of docker-compose.yaml.
func (*Config) WarnIfConfigReplace ¶ added in v0.9.4
func (c *Config) WarnIfConfigReplace()
WarnIfConfigReplace just messages user about whether config is being replaced or created
func (*Config) WriteDockerComposeConfig ¶
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(config *Config) 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 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(config *Config) 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(*Config) error
ValidateField(string, string) error
PromptForConfig() error
Write(string) error
Read(string) error
Validate() error
GetBackup(string) (fileLocation string, importPath string, err error)
}
Provider in the interface which all provider plugins must implement.