Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Log = log.New(os.Stderr).WithTimestamp().WithoutColor()
Log is the logger utility
Functions ¶
func ChunkifyFiles ¶
ChunkifyFiles will give the chunks of the files array
func DisconnectSSHConnections ¶
func DisconnectSSHConnections(conn SSHConnections)
DisconnectSSHConnections will close all the SSH connections
func GetConfigFile ¶
func GetConfigFile() string
GetConfigFile manages to get the config file path using 3 different lookups The order of search is: SYNCBIT_CONFIG environment variable -> First cli argument -> Input prompt
func GetStagingFileName ¶
func GetStagingFileName() string
GetStagingFileName will generate a random string of 13 chars and return
Types ¶
type Adaptor ¶
type Adaptor struct { // Name of the adaptor for reference Name string `yaml:"name"` // User to connect to SSH (default: "root") User string `yaml:"user"` // Host can be ip or hostname to connect (default: "localhost") Host string `yaml:"host"` // Pass is used for authenticating the SSH connection (default: ""). It can be either ssh private key or an actual password Pass string `yaml:"pass"` // Port is the SSH port to create new connection on (default: 22) Port int `yaml:"port"` }
Adaptor is the type definition for connection adaptors
func GetAdaptorFromName ¶
GetAdaptorFromName will give the adaptor details from its name
type Config ¶
type Config struct { // Settings is used to define the behaviour of the application Settings Settings `yaml:"settings"` // Adaptors are used to hold the connection objects. This can be used to transfer data Adaptors []Adaptor `yaml:"adaptors"` // Global scoped actions Global Global `yaml:"global"` // Files are the directories to zip, download and upload Files []File `yaml:"files"` }
Config struct holds the parsed data for of config file
type Dest ¶
type Dest struct { // Path is the directory to restore Path string `yaml:"path"` // Adaptor is the name of the connection adaptor from adaptors array Adaptor string `yaml:"adaptor"` // PreUpload will be executed before uploading the zip file PreUpload []string `yaml:"pre-upload"` // PostUpload will be executed after uploading the zip file PostUpload []string `yaml:"post-upload"` // PreRestore will be executed before unzipping the file PreRestore []string `yaml:"pre-restore"` // PostRestore will be executed after uploading the file PostRestore []string `yaml:"post-restore"` }
Dest is the type definition for destination location
type File ¶
type File struct { // Src config contains the details for the backup Src Src `yaml:"src"` // Dest config contains the details for the restore Dest Dest `yaml:"dest"` }
File is the type definition for backup files
type Global ¶
type Global struct { // Hooks are the actions to be performed on SSH session on particular event Hooks Hooks `yaml:"hooks"` }
Global are the top level scope settings for handle transfer function
type Hooks ¶
type Hooks struct { // PreBackup will be executed before zipping the directory on the source adaptor PreBackup []string `yaml:"pre-backup"` // PostBackup will be executed after zipping the directory on the source adaptor PostBackup []string `yaml:"post-backup"` // PreDownload will be executed before downloading the zipped file on the source adaptor PreDownload []string `yaml:"pre-download"` // PostDownload will be executed after downloading the zipped file on the source adaptor PostDownload []string `yaml:"post-download"` // PreUpload will be executed before uploading the zip file on the destination adaptor PreUpload []string `yaml:"pre-upload"` // PostUpload will be executed after uploading the zip file on the destination adaptor PostUpload []string `yaml:"post-upload"` // PreRestore will be executed before unzipping the file on the destination adaptor PreRestore []string `yaml:"pre-restore"` // PostRestore will be executed after uploading the file on the destination adaptor PostRestore []string `yaml:"post-restore"` }
Hooks type is used for global hooks
type SSHConnections ¶
SSHConnections is simplified type for ssh connections
func GetSSHConnections ¶
func GetSSHConnections(conf Config) SSHConnections
GetSSHConnections will connect to SSH from adaptors array and return SSHConnections
type Settings ¶
type Settings struct { // Verbose will tell logger to show debug logs on stderr Verbose bool `yaml:"verbose"` // Colors will add the beautiful distinguishable logs on the stderr Colors bool `yaml:"colors"` }
Settings is the type for holding application level config
type Src ¶
type Src struct { // Path is the directory for backup Path string `yaml:"path"` // Adaptor is the name of the connection adaptor from adaptors array Adaptor string `yaml:"adaptor"` // PreBackup will be executed before zipping the directory PreBackup []string `yaml:"pre-backup"` // PostBackup will be executed after zipping the directory PostBackup []string `yaml:"post-backup"` // PreDownload will be executed before downloading the zipped file PreDownload []string `yaml:"pre-download"` // PostDownload will be executed after downloading the zipped file PostDownload []string `yaml:"post-download"` }
Src is the type definition for source directory