Documentation
¶
Index ¶
- Variables
- func CreateTempfile() *os.File
- func CreateTempfileWithContent(content ...string) *os.File
- func FileExists(name string) bool
- func PathExists(name string) bool
- func RsyncPath(name string) string
- func ShellErrorHandler(recover interface{})
- type Database
- func (database *Database) ApplyDefaults(server *Server)
- func (database *Database) Deploy()
- func (database *Database) GetMysql() DatabaseMysql
- func (database *Database) GetPostgres() DatabasePostgres
- func (database *Database) GetType() (dbtype string)
- func (database *Database) String(direction string) string
- func (database *Database) Sync()
- type DatabaseMysql
- type DatabaseOptions
- type DatabasePostgres
- type EnvironmentVar
- type Execution
- type Filesystem
- type FilesystemOptions
- type Filter
- type RunConfiguration
- type Server
- func (server *Server) AsYaml() string
- func (server *Server) Deploy()
- func (server *Server) DeployDatabases()
- func (server *Server) DeployFilesystem()
- func (server *Server) GetExecByWhen(when string) []Execution
- func (server *Server) GetLocalPath() string
- func (server *Server) Init()
- func (server *Server) RunExec(when string)
- func (server *Server) SetRunConfiguration(conf RunConfiguration)
- func (server *Server) Sync()
- func (server *Server) SyncDatabases()
- func (server *Server) SyncFilesystem()
- type SyncConfig
- func (config *SyncConfig) GetDeployServer(serverName string) (Server, error)
- func (config *SyncConfig) GetServerList(confType string) (list []string)
- func (config *SyncConfig) GetSyncServer(serverName string) (Server, error)
- func (config *SyncConfig) ListServer() (list map[string][]string)
- func (config *SyncConfig) ShowConfiguration()
- type YamlCommandBuilderArgument
- type YamlCommandBuilderConnection
- type YamlStringArray
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Logger *logger.SyncLogger
)
Functions ¶
func CreateTempfile ¶
func FileExists ¶
func PathExists ¶
func ShellErrorHandler ¶
func ShellErrorHandler(recover interface{})
Types ¶
type Database ¶
type Database struct {
// Type of database (either mysql or postgres)
Type string `yaml:"type"`
// Database name on remote database server
Db string `yaml:"database"`
// Hostname of remote database server
Hostname string `yaml:"hostname"`
// Port of remote database server
Port string `yaml:"port"`
// Username of remote database server
User string `yaml:"user"`
// Password of remote database server
Password string `yaml:"password"`
// Table filter
Filter Filter `yaml:"filter"`
// Connection for database sync (optional, default is Server connection)
Connection *YamlCommandBuilderConnection `yaml:"connection"`
// Database options
Options DatabaseOptions `yaml:"options"`
Local struct {
// Database name on local database server
Db string `yaml:"database"`
// Hostname of local database server
Hostname string `yaml:"hostname"`
// Port of local database server
Port string `yaml:"port"`
// Username of local database server
User string `yaml:"user"`
// Password of local database server
Password string `yaml:"password"`
// Connection for database sync (optional, default is empty)
Connection *YamlCommandBuilderConnection `yaml:"connection"`
// Database options
Options DatabaseOptions `yaml:"options"`
} `yaml:"local"`
// contains filtered or unexported fields
}
func (*Database) ApplyDefaults ¶
func (*Database) GetMysql ¶
func (database *Database) GetMysql() DatabaseMysql
func (*Database) GetPostgres ¶
func (database *Database) GetPostgres() DatabasePostgres
type DatabaseMysql ¶
type DatabaseMysql struct {
Database
}
type DatabaseOptions ¶
type DatabaseOptions struct {
// Clear database with DROP/CREATE before sync
ClearDatabase bool `yaml:"clear-database"`
// Arguments for mysqldump command
Mysqldump *YamlStringArray `yaml:"mysqldump"`
// Arguments for mysql command
Mysql *YamlStringArray `yaml:"mysql"`
// Arguments for pgdump command
Pgdump *YamlStringArray `yaml:"pgdump"`
// Arguments for psql command
Psql *YamlStringArray `yaml:"psql"`
}
type DatabasePostgres ¶
type DatabasePostgres struct {
Database
}
type EnvironmentVar ¶
type Execution ¶
type Execution struct {
// Type of execution (remote or local)
Type string `yaml:"type"`
// Command as string or as elements
Command YamlStringArray `yaml:"command"`
// Workdir for execution
Workdir string `yaml:"workdir"`
// Environment variables
Environment []EnvironmentVar `yaml:"environment"`
// Execution options
Options struct {
} `yaml:"options"`
}
type Filesystem ¶
type Filesystem struct {
// Remove path
Path string `yaml:"path"`
// Local path (optional)
Local string `yaml:"local"`
// Filter
Filter Filter `yaml:"filter"`
// Connection for filesystem sync (optional, default is Server connection)
Connection *YamlCommandBuilderConnection `yaml:"connection"`
Options FilesystemOptions `yaml:"options"`
}
func (*Filesystem) ApplyDefaults ¶
func (filesystem *Filesystem) ApplyDefaults(server *Server)
func (*Filesystem) String ¶
func (filesystem *Filesystem) String(direction string) string
type FilesystemOptions ¶
type FilesystemOptions struct {
// Generate stubs (small example files) instead of fetching files from remote
GenerateStubs bool `yaml:"generate-stubs"`
// Arguments for psql command
Rsync *YamlStringArray `yaml:"rsync"`
}
type Filter ¶
type Filter struct {
// Exclude as strings (regexp)
Exclude []string `yaml:"exclude"`
// Includes as strings (regexp)
Include []string `yaml:"include"`
// contains filtered or unexported fields
}
func (*Filter) ApplyFilter ¶
Apply filter (exclude/include) and get filtered list
func (*Filter) CalcExcludes ¶
Apply exclude filter only and get filtered excludes
func (*Filter) CalcIncludes ¶
Apply includes filter only and get filtered includes
type RunConfiguration ¶
type Server ¶
type Server struct {
// General working path (for filesystem syncs)
Path string `yaml:"path"`
// General connection (default for all remote connections)
Connection *YamlCommandBuilderConnection `yaml:"connection"`
// Filesystem sync list
Filesystem []Filesystem `yaml:"filesystem"`
// Database sync list
Database []Database `yaml:"database"`
// Startup execution list (executed before sync)
ExecStartup []Execution `yaml:"exec-startup"`
// Finish execution list (executed after sync)
ExecFinish []Execution `yaml:"exec-finish"`
// contains filtered or unexported fields
}
func (*Server) DeployDatabases ¶
func (server *Server) DeployDatabases()
func (*Server) DeployFilesystem ¶
func (server *Server) DeployFilesystem()
func (*Server) GetExecByWhen ¶
func (*Server) GetLocalPath ¶
func (*Server) SetRunConfiguration ¶
func (server *Server) SetRunConfiguration(conf RunConfiguration)
func (*Server) SyncDatabases ¶
func (server *Server) SyncDatabases()
func (*Server) SyncFilesystem ¶
func (server *Server) SyncFilesystem()
type SyncConfig ¶
type SyncConfig struct {
// Sync (remote -> local) configurations
Sync map[string]Server `yaml:"sync"`
// Deploy (local -> remote) configurations
Deploy map[string]Server `yaml:"deploy"`
}
func NewConfigParser ¶
func NewConfigParser(file string) (config *SyncConfig)
func (*SyncConfig) GetDeployServer ¶
func (config *SyncConfig) GetDeployServer(serverName string) (Server, error)
func (*SyncConfig) GetServerList ¶
func (config *SyncConfig) GetServerList(confType string) (list []string)
func (*SyncConfig) GetSyncServer ¶
func (config *SyncConfig) GetSyncServer(serverName string) (Server, error)
func (*SyncConfig) ListServer ¶
func (config *SyncConfig) ListServer() (list map[string][]string)
List all possible server configurations
func (*SyncConfig) ShowConfiguration ¶
func (config *SyncConfig) ShowConfiguration()
Show all possible server configurations in an human readable style
type YamlCommandBuilderArgument ¶
type YamlCommandBuilderArgument struct {
commandbuilder.Argument
}
func (*YamlCommandBuilderArgument) String ¶
func (ysa *YamlCommandBuilderArgument) String() string
func (*YamlCommandBuilderArgument) UnmarshalYAML ¶
func (yarg *YamlCommandBuilderArgument) UnmarshalYAML(unmarshal func(interface{}) error) error
type YamlCommandBuilderConnection ¶
type YamlCommandBuilderConnection struct {
Type string
Ssh *YamlCommandBuilderArgument
Docker *YamlCommandBuilderArgument
Environment *map[string]string
Workdir string
// contains filtered or unexported fields
}
func (*YamlCommandBuilderConnection) Clone ¶
func (yconn *YamlCommandBuilderConnection) Clone() (conn *YamlCommandBuilderConnection)
Clone yaml connection (without shell connection instance)
func (*YamlCommandBuilderConnection) GetInstance ¶
func (yconn *YamlCommandBuilderConnection) GetInstance() *commandbuilder.Connection
Get (or create) connection instance will be cached one it's created
func (*YamlCommandBuilderConnection) IsEmpty ¶
func (yconn *YamlCommandBuilderConnection) IsEmpty() (status bool)
Checks if connection is empty
type YamlStringArray ¶
func (*YamlStringArray) Array ¶
func (ysa *YamlStringArray) Array() (command []string)
func (*YamlStringArray) String ¶
func (ysa *YamlStringArray) String() string
func (*YamlStringArray) ToString ¶
func (ysa *YamlStringArray) ToString(sep string) string
func (*YamlStringArray) UnmarshalYAML ¶
func (ysa *YamlStringArray) UnmarshalYAML(unmarshal func(interface{}) error) error
Source Files
¶
- config.go
- configparser.go
- database.go
- database_mysql.go
- database_mysql_local.go
- database_mysql_remote.go
- database_postgres.go
- database_postgres_local.go
- database_postgres_remote.go
- execution.go
- filesystem.go
- filter.go
- global.go
- helper.go
- server.go
- server_deploy.go
- server_deploy_database.go
- server_deploy_filesystem.go
- server_exec.go
- server_sync.go
- server_sync_database.go
- server_sync_filesystem.go
- server_sync_filesystem_stubs.go
- yaml_commandbuilder_argument.go
- yaml_commandbuilder_connection.go
- yaml_string_array.go
Click to show internal directories.
Click to hide internal directories.