config

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMydumperPath added in v1.1.5

func FindMydumperPath() string

func FindMyloaderPath added in v1.1.5

func FindMyloaderPath() string

func FindMysqlPath added in v1.1.5

func FindMysqlPath() string

func FindMysqldumpPath added in v1.1.5

func FindMysqldumpPath() string

Public functions for external access

func FindRclonePath added in v1.1.5

func FindRclonePath() string

func GetActiveConfigPath added in v1.1.2

func GetActiveConfigPath() (string, error)

GetActiveConfigPath returns the path of the config file that would be used

func GetConfigPaths added in v1.1.2

func GetConfigPaths() []string

GetConfigPaths returns the config paths for the current platform (for CLI help)

Types

type BackupConfig

type BackupConfig struct {
	Directory           string            `mapstructure:"directory"`
	Databases           []string          `mapstructure:"databases"`
	BatchSize           int               `mapstructure:"batch_size"`
	Concurrency         int               `mapstructure:"concurrency"`
	Timeout             time.Duration     `mapstructure:"timeout"`
	RetryCount          int               `mapstructure:"retry_count"`
	RetryDelay          time.Duration     `mapstructure:"retry_delay"`
	CheckLastBackupTime bool              `mapstructure:"check_last_backup_time"`
	MinBackupInterval   time.Duration     `mapstructure:"min_backup_interval"`
	SkipConfirmation    bool              `mapstructure:"skip_confirmation"`
	Compression         CompressionConfig `mapstructure:"compression"`
}

type CleanupConfig

type CleanupConfig struct {
	Enabled              bool     `mapstructure:"enabled"`
	CleanupUploadedFiles bool     `mapstructure:"cleanup_uploaded_files"`
	RemoteRetention      int      `mapstructure:"remote_retention_days"`
	WeekendOnly          bool     `mapstructure:"weekend_only"`
	AgeBasedCleanup      bool     `mapstructure:"age_based_cleanup"`
	MaxAgeDays           int      `mapstructure:"max_age_days"`
	VerifyCloudExists    bool     `mapstructure:"verify_cloud_exists"`
	Databases            []string `mapstructure:"databases"`
}

type CompressionConfig added in v1.1.4

type CompressionConfig struct {
	Enabled        bool   `mapstructure:"enabled"`
	Format         string `mapstructure:"format"`          // "tar.gz", "tar.zst", "tar.xz"
	Level          int    `mapstructure:"level"`           // 1-9 compression level
	KeepOriginal   bool   `mapstructure:"keep_original"`   // Keep uncompressed backup locally
	CompressUpload bool   `mapstructure:"compress_upload"` // Only compress for upload
}

CompressionConfig controls backup compression settings

type Config

type Config struct {
	Database DatabaseConfig `mapstructure:"database"`
	Backup   BackupConfig   `mapstructure:"backup"`
	Upload   UploadConfig   `mapstructure:"upload"`
	Logging  LoggingConfig  `mapstructure:"logging"`
	Cleanup  CleanupConfig  `mapstructure:"cleanup"`
	Metrics  MetricsConfig  `mapstructure:"metrics"`
}

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

type DatabaseConfig

type DatabaseConfig struct {
	Host          string          `mapstructure:"host"`
	Port          int             `mapstructure:"port"`
	Username      string          `mapstructure:"username"`
	Password      string          `mapstructure:"password"`
	Timeout       int             `mapstructure:"timeout"`
	MysqldumpPath string          `mapstructure:"mysqldump_path"`
	MysqlPath     string          `mapstructure:"mysql_path"`
	Mydumper      *MydumperConfig `mapstructure:"mydumper"`
}

type LoggingConfig

type LoggingConfig struct {
	Level      string `mapstructure:"level"`
	Format     string `mapstructure:"format"`
	FileFormat string `mapstructure:"file_format"`
	FilePath   string `mapstructure:"file_path"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled     bool   `mapstructure:"enabled"`
	Port        string `mapstructure:"port"`
	StoragePath string `mapstructure:"storage_path"`
}

type MydumperConfig

type MydumperConfig struct {
	Enabled         bool            `mapstructure:"enabled"`
	BinaryPath      string          `mapstructure:"binary_path"`
	DefaultsFile    string          `mapstructure:"defaults_file"`
	Threads         int             `mapstructure:"threads"`
	ChunkFilesize   int             `mapstructure:"chunk_filesize"`
	CompressMethod  string          `mapstructure:"compress_method"`
	BuildEmptyFiles bool            `mapstructure:"build_empty_files"`
	UseDefer        bool            `mapstructure:"use_defer"`
	SingleTable     bool            `mapstructure:"single_table"`
	NoSchemas       bool            `mapstructure:"no_schemas"`
	NoData          bool            `mapstructure:"no_data"`
	Myloader        *MyloaderConfig `mapstructure:"myloader"`
}

MydumperConfig supports cross-platform mydumper versions with automatic parameter detection Tested and supported versions:

  • v0.9.1+ (Ubuntu 18.04, older Linux distributions)
  • v0.10.0+ (most modern Linux distributions)
  • v0.19.3+ (macOS Homebrew, latest versions)

The system automatically detects version and uses appropriate parameters for compatibility

type MyloaderConfig

type MyloaderConfig struct {
	Enabled      bool   `mapstructure:"enabled"`
	BinaryPath   string `mapstructure:"binary_path"`
	DefaultsFile string `mapstructure:"defaults_file"`
	Threads      int    `mapstructure:"threads"`
}

type UploadConfig

type UploadConfig struct {
	Enabled          bool   `mapstructure:"enabled"`
	RclonePath       string `mapstructure:"rclone_path"`
	RcloneConfigPath string `mapstructure:"rclone_config_path"`
	Destination      string `mapstructure:"destination"`
	Timeout          int    `mapstructure:"timeout"`
	RetryCount       int    `mapstructure:"retry_count"`
}

Jump to

Keyboard shortcuts

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