ddevapp

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const DDevComposeTemplate = `` /* 2154-byte string literal not displayed */

DDevComposeTemplate is used to create the main docker-compose.yaml file for a ddev site.

View Source
const DDevDefaultPlatform = "local"

DDevDefaultPlatform defines the DDev Platform. It's just hardcoded for now, but should be adjusted as we add more platforms.

View Source
const DDevTLD = "ddev.local"

DDevTLD defines the tld to use for DDev site URLs.

View Source
const DefaultProviderName = "default"

DefaultProviderName contains the name of the default provider which will be used if one is not otherwise specified.

View Source
const Drupal7Hooks = `
#     - exec: "drush cc all"`

Drupal7Hooks adds a d7-specific hooks example for post-import-db

View Source
const Drupal8Hooks = `
#     - exec: "drush cr"`

Drupal8Hooks adds a d8-specific hooks example for post-import-db

View Source
const HookTemplate = `` /* 301-byte string literal not displayed */

HookTemplate is used to add example hooks usage

View Source
const WordPressHooks = `` /* 171-byte string literal not displayed */

WordPressHooks adds a wp-specific hooks example for post-import-db

Variables

View Source
var AllowedAppTypes = []string{"drupal7", "drupal8", "wordpress"}

AllowedAppTypes lists the types of site/app that can be used.

Functions

func IsAllowedAppType

func IsAllowedAppType(appType string) bool

IsAllowedAppType determines if a given string exists in the AllowedAppTypes slice.

func PrepDdevDirectory

func PrepDdevDirectory(dir string) error

PrepDdevDirectory creates a .ddev directory in the current working

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

func NewConfig(AppRoot string, provider string) (*Config, error)

NewConfig creates a new Config struct with defaults set. It is preferred to using new() directly.

func (*Config) Config

func (c *Config) Config() error

Config goes through a set of prompts to receive user input and generate an Config struct.

func (*Config) ConfigExists

func (c *Config) ConfigExists() bool

ConfigExists determines if a ddev config file exists for this application.

func (*Config) DockerComposeYAMLPath

func (c *Config) DockerComposeYAMLPath() string

DockerComposeYAMLPath returns the absolute path to where the docker-compose.yaml should exist for this app configuration.

func (*Config) GetPath

func (c *Config) GetPath(filename string) string

GetPath returns the path to an application config file specified by filename.

func (*Config) GetProvider

func (c *Config) GetProvider() (Provider, error)

GetProvider returns a pointer to the provider instance interface.

func (*Config) Hostname

func (c *Config) Hostname() string

Hostname returns the hostname to the app controlled by this config.

func (*Config) Read

func (c *Config) Read() error

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

func (c *Config) RenderComposeYAML() (string, error)

RenderComposeYAML renders the contents of docker-compose.yaml.

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures the configuraton meets ddev's requirements.

func (*Config) Write

func (c *Config) Write() error

Write the app configuration to the .ddev folder.

func (*Config) WriteDockerComposeConfig

func (c *Config) WriteDockerComposeConfig() error

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) Config

func (p *DefaultProvider) Config() error

Config provides a no-op for the Config operation.

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) 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 returns an error from the default provider, as we have no provider to import data from.

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"`

	Environment string `yaml:"environment"`
	// contains filtered or unexported fields
}

PantheonProvider provides pantheon-specific import functionality.

func (*PantheonProvider) Config

func (p *PantheonProvider) Config() error

Config provides interactive configuration prompts when running `ddev config pantheon`

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) Read

func (p *PantheonProvider) Read(configPath string) error

Read pantheon provider configuration from a specified location on disk.

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
	Config() 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL