Add scheduled rotating local backups

This commit is contained in:
Mikhail Chusavitin
2026-02-11 19:48:40 +03:00
parent 7fbf813952
commit a1edca3be9
8 changed files with 559 additions and 22 deletions

View File

@@ -20,6 +20,7 @@ type Config struct {
Alerts AlertsConfig `yaml:"alerts"`
Notifications NotificationsConfig `yaml:"notifications"`
Logging LoggingConfig `yaml:"logging"`
Backup BackupConfig `yaml:"backup"`
}
type ServerConfig struct {
@@ -101,6 +102,10 @@ type LoggingConfig struct {
FilePath string `yaml:"file_path"`
}
type BackupConfig struct {
Time string `yaml:"time"`
}
func Load(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
@@ -182,6 +187,10 @@ func (c *Config) setDefaults() {
if c.Logging.Output == "" {
c.Logging.Output = "stdout"
}
if c.Backup.Time == "" {
c.Backup.Time = "00:00"
}
}
func (c *Config) Address() string {