Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigFilePath() string
- func ContextExists(name string) (bool, error)
- func Current() (string, error)
- func DeleteCronSpec(name string) error
- func DetectComposeNetworkName(projectDir, composeProjectName string) string
- func DetectComposeProjectName(projectDir string) string
- func DetectContextComposeNetwork(ctx *Context) string
- func ExpandProjectDir(value string) (string, error)
- func GetDefaultLocalDockerSocket(dockerSocket string) string
- func GetInput(question ...string) (string, error)
- func IsDockerSocketAlive(socket string) bool
- func LooksLikeComposeProject(projectDir string) bool
- func ResolveCurrentContextName(f *pflag.FlagSet) (string, error)
- func Save(cfg *Config) error
- func SaveContext(ctx *Context, setDefault bool) error
- func SaveCronSpec(spec CronSpec) error
- func SetCommandFlags(flags *pflag.FlagSet)
- func ValidateExistingComposeProjectDir(projectDir string) error
- type Config
- type Context
- func CurrentContext(f *pflag.FlagSet) (*Context, error)
- func DiscoverCurrentContext() (*Context, error)
- func FindLocalContextByProjectDir(projectDir string) (*Context, error)
- func GetContext(name string) (Context, error)
- func LoadFromFlags(f *pflag.FlagSet, context Context) (*Context, error)
- func PromptAndSaveLocalContext(opts LocalContextCreateOptions) (*Context, error)
- func (c *Context) DialSSH() (*ssh.Client, error)
- func (c Context) EffectiveComposeNetwork() string
- func (c Context) EffectiveComposeProjectName() string
- func (c *Context) EffectiveDrupalContainerRoot() string
- func (c *Context) EffectiveDrupalRootfs() string
- func (c Context) EnsureTrackedComposeOverrideSymlink() error
- func (c *Context) FileExists(path string) (bool, error)
- func (c *Context) GetSshUri() string
- func (c *Context) HasComposeProject() (bool, error)
- func (c *Context) ListFiles(root string) ([]string, error)
- func (c *Context) NewFileAccessor() (*FileAccessor, error)
- func (c Context) OverrideEnvironment() string
- func (c *Context) ProjectDirExists() (bool, error)
- func (c *Context) ReadFile(filename string) ([]byte, error)
- func (c *Context) ReadSmallFile(filename string) (string, error)
- func (c *Context) RemoveFile(filename string) error
- func (c *Context) ResolveProjectPath(path string) string
- func (c *Context) RunCommand(cmd *exec.Cmd) (string, error)
- func (c *Context) RunCommandContext(ctx context.Context, cmd *exec.Cmd) (string, error)
- func (c *Context) RunQuietCommand(cmd *exec.Cmd) (string, error)
- func (c *Context) RunQuietCommandContext(ctx context.Context, cmd *exec.Cmd) (string, error)
- func (c Context) RuntimeComposeOverridePath() string
- func (context Context) String() (string, error)
- func (c Context) TrackedComposeOverrideName() string
- func (c Context) TrackedComposeOverridePath() string
- func (c *Context) UploadFile(source, destination string) error
- func (c *Context) ValidateComposeAccess() error
- func (c Context) ValidateTrackedComposeOverrideSymlink() error
- func (cc *Context) VerifyRemoteInput(existingSite bool) error
- func (c *Context) WriteFile(filename string, data []byte) error
- type ContextType
- type CronSpec
- type FileAccessor
- func (a *FileAccessor) Close() error
- func (a *FileAccessor) FileExists(path string) (bool, error)
- func (a *FileAccessor) ListFiles(root string) ([]string, error)
- func (a *FileAccessor) MkdirAll(path string) error
- func (a *FileAccessor) ReadFile(filename string) ([]byte, error)
- func (a *FileAccessor) ReadFileContext(ctx context.Context, filename string) ([]byte, error)
- func (a *FileAccessor) ReadFiles(paths []string) (map[string][]byte, error)
- func (a *FileAccessor) ReadFilesContext(ctx context.Context, paths []string) (map[string][]byte, error)
- func (a *FileAccessor) RemoveAll(path string) error
- func (a *FileAccessor) RemoveFile(filename string) error
- func (a *FileAccessor) Stat(path string) (fs.FileInfo, error)
- func (a *FileAccessor) UploadFile(source, destination string) error
- func (a *FileAccessor) WriteFile(filename string, data []byte) error
- type FileReader
- type InputFunc
- type LocalContextCreateOptions
Constants ¶
View Source
const RuntimeComposeOverrideName = "docker-compose.override.yml"
Variables ¶
View Source
var ErrContextNotFound = errors.New("context not found")
Functions ¶
func ConfigFilePath ¶
func ConfigFilePath() string
func ContextExists ¶
func DeleteCronSpec ¶ added in v0.13.0
func DetectComposeNetworkName ¶ added in v0.10.0
func DetectComposeProjectName ¶ added in v0.10.0
func DetectContextComposeNetwork ¶ added in v0.10.0
func ExpandProjectDir ¶ added in v0.10.0
func GetDefaultLocalDockerSocket ¶
for local contexts, try a bunch of common paths grab the docker socket this is mostly needed for Mac OS
func IsDockerSocketAlive ¶ added in v0.9.0
func LooksLikeComposeProject ¶ added in v0.9.0
func ResolveCurrentContextName ¶ added in v0.9.0
func SaveContext ¶
func SaveCronSpec ¶ added in v0.13.0
func SetCommandFlags ¶
func ValidateExistingComposeProjectDir ¶ added in v0.9.0
Types ¶
type Config ¶
type Context ¶
type Context struct {
Name string `yaml:"name"`
Site string `yaml:"site"`
Plugin string `yaml:"plugin"`
DockerHostType ContextType `mapstructure:"type" yaml:"type"`
Environment string `yaml:"environment,omitempty"`
DockerSocket string `yaml:"docker-socket"`
ProjectName string `yaml:"project-name"`
ComposeProjectName string `yaml:"compose-project-name,omitempty"`
ComposeNetwork string `yaml:"compose-network,omitempty"`
ProjectDir string `yaml:"project-dir"`
DrupalRootfs string `yaml:"drupal-rootfs,omitempty"`
DrupalContainerRoot string `yaml:"drupal-container-root,omitempty"`
SSHUser string `yaml:"ssh-user"`
SSHHostname string `yaml:"ssh-hostname,omitempty"`
SSHPort uint `yaml:"ssh-port,omitempty"`
SSHKeyPath string `yaml:"ssh-key,omitempty"`
EnvFile []string `yaml:"env-file"`
ComposeFile []string `yaml:"compose-file,omitempty"`
// Database connection configuration
DatabaseService string `yaml:"database-service,omitempty"`
DatabaseUser string `yaml:"database-user,omitempty"`
DatabasePasswordSecret string `yaml:"database-password-secret,omitempty"`
DatabaseName string `yaml:"database-name,omitempty"`
ReadSmallFileFunc func(filename string) (string, error) `yaml:"-"`
// Extra holds plugin-specific configuration.
// Each plugin uses its own key (e.g., "drupal", "isle", "wordpress").
Extra map[string]yaml.Node `yaml:"extra,omitempty"`
}
func DiscoverCurrentContext ¶ added in v0.9.0
func FindLocalContextByProjectDir ¶ added in v0.9.0
func GetContext ¶
func PromptAndSaveLocalContext ¶ added in v0.5.0
func PromptAndSaveLocalContext(opts LocalContextCreateOptions) (*Context, error)
func (Context) EffectiveComposeNetwork ¶ added in v0.10.0
func (Context) EffectiveComposeProjectName ¶ added in v0.10.0
func (*Context) EffectiveDrupalContainerRoot ¶ added in v0.13.0
func (*Context) EffectiveDrupalRootfs ¶ added in v0.13.0
func (Context) EnsureTrackedComposeOverrideSymlink ¶ added in v0.9.0
func (*Context) FileExists ¶ added in v0.9.0
func (*Context) HasComposeProject ¶ added in v0.9.0
func (*Context) ListFiles ¶ added in v0.5.0
ListFiles lists files under a directory relative to the directory root.
func (*Context) NewFileAccessor ¶ added in v0.12.0
func (c *Context) NewFileAccessor() (*FileAccessor, error)
func (Context) OverrideEnvironment ¶ added in v0.9.0
func (*Context) ProjectDirExists ¶
func (*Context) ReadFile ¶ added in v0.5.0
ReadFile reads a file from the context, supporting local and remote paths.
func (*Context) RemoveFile ¶ added in v0.5.0
RemoveFile removes a file from the context.
func (*Context) ResolveProjectPath ¶ added in v0.9.0
func (*Context) RunCommandContext ¶ added in v0.12.0
func (*Context) RunQuietCommand ¶ added in v0.9.0
func (*Context) RunQuietCommandContext ¶ added in v0.12.0
func (Context) RuntimeComposeOverridePath ¶ added in v0.9.0
func (Context) TrackedComposeOverrideName ¶ added in v0.9.0
func (Context) TrackedComposeOverridePath ¶ added in v0.9.0
func (*Context) UploadFile ¶
func (*Context) ValidateComposeAccess ¶ added in v0.9.0
func (Context) ValidateTrackedComposeOverrideSymlink ¶ added in v0.9.0
func (*Context) VerifyRemoteInput ¶
type ContextType ¶
type ContextType string
const ( ContextLocal ContextType = "local" ContextRemote ContextType = "remote" )
type CronSpec ¶ added in v0.13.0
type CronSpec struct {
Name string `yaml:"name"`
Context string `yaml:"context"`
Schedule string `yaml:"schedule"`
OutputDir string `yaml:"output-dir"`
Components []string `yaml:"components,omitempty"`
RetentionDays int `yaml:"retention-days,omitempty"`
PreserveFirstOfMonth bool `yaml:"preserve-first-of-month,omitempty"`
DockerPrune bool `yaml:"docker-prune,omitempty"`
}
func GetCronSpec ¶ added in v0.13.0
type FileAccessor ¶ added in v0.12.0
type FileAccessor struct {
// contains filtered or unexported fields
}
func NewFileAccessor ¶ added in v0.12.0
func NewFileAccessor(ctx *Context) (*FileAccessor, error)
func NewFileAccessorWithSSH ¶ added in v0.12.0
func (*FileAccessor) Close ¶ added in v0.12.0
func (a *FileAccessor) Close() error
func (*FileAccessor) FileExists ¶ added in v0.12.0
func (a *FileAccessor) FileExists(path string) (bool, error)
func (*FileAccessor) ListFiles ¶ added in v0.12.0
func (a *FileAccessor) ListFiles(root string) ([]string, error)
func (*FileAccessor) MkdirAll ¶ added in v0.13.0
func (a *FileAccessor) MkdirAll(path string) error
func (*FileAccessor) ReadFile ¶ added in v0.12.0
func (a *FileAccessor) ReadFile(filename string) ([]byte, error)
func (*FileAccessor) ReadFileContext ¶ added in v0.12.0
func (*FileAccessor) ReadFiles ¶ added in v0.12.0
func (a *FileAccessor) ReadFiles(paths []string) (map[string][]byte, error)
func (*FileAccessor) ReadFilesContext ¶ added in v0.12.0
func (*FileAccessor) RemoveAll ¶ added in v0.13.0
func (a *FileAccessor) RemoveAll(path string) error
func (*FileAccessor) RemoveFile ¶ added in v0.12.0
func (a *FileAccessor) RemoveFile(filename string) error
func (*FileAccessor) Stat ¶ added in v0.12.0
func (a *FileAccessor) Stat(path string) (fs.FileInfo, error)
func (*FileAccessor) UploadFile ¶ added in v0.12.0
func (a *FileAccessor) UploadFile(source, destination string) error
type FileReader ¶
FileReader defines the behavior needed to read small files.
type LocalContextCreateOptions ¶ added in v0.5.0
type LocalContextCreateOptions struct {
Name string
DefaultName string
Site string
DefaultSite string
Plugin string
DefaultPlugin string
ProjectDir string
DefaultProjectDir string
ProjectName string
DefaultProjectName string
ComposeProjectName string
ComposeNetwork string
Environment string
DockerSocket string
DrupalRootfs string
DrupalContainerRoot string
SetDefault bool
ConfirmOverwrite bool
Input InputFunc
ProjectDirValidator func(string) error
ContextNamePrompt []string
ProjectDirPrompt []string
OverwritePrompt []string
}
Click to show internal directories.
Click to hide internal directories.