internal

package
v0.0.0-...-48de290 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Shell = "/bin/sh"

Variables

This section is empty.

Functions

func Reap

func Reap(pid int)

func SetFlags

func SetFlags(cmd *exec.Cmd)

Set parent ground and death signal to be sure that nested processes will be closed

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) *App

func (*App) Ready

func (app *App) Ready() bool

func (*App) Run

func (app *App) Run(ctx context.Context) error

type Config

type Config struct {
	Schedule     string           `long:"schedule" env:"SCHEDULE" description:"Backup schedule" default:"@daily"`
	Dir          string           `long:"dir" env:"DIR" description:"Directory to backup and restore" default:"/data"`
	Prune        string           `long:"prune" env:"PRUNE" description:"Cleanup and prune backups schedule" default:"@daily"`
	Depth        int              `long:"depth" env:"DEPTH" description:"How many snapshots to keep" default:"7"`
	Restic       string           `long:"restic" env:"RESTIC" description:"Restic binary" default:"restic"`
	LogLimit     int              `` /* 136-byte string literal not displayed */
	Notification HTTPNotification `group:"Webhook notification" namespace:"notification" env-namespace:"NOTIFICATION"`
}

type HTTPNotification

type HTTPNotification struct {
	URL           string        `long:"url" env:"URL" description:"URL to invoke"`
	Retries       int           `long:"retries" env:"RETRIES" description:"Number of additional retries" default:"5"`
	Interval      time.Duration `long:"interval" env:"INTERVAL" description:"Interval between attempts" default:"12s"`
	Method        string        `long:"method" env:"METHOD" description:"HTTP method" default:"POST"`
	Timeout       time.Duration `long:"timeout" env:"TIMEOUT" description:"Request timeout" default:"30s"`
	Authorization string        `long:"authorization" env:"AUTHORIZATION" description:"Authorization header value"`
}

func (*HTTPNotification) Auto

func (ht *HTTPNotification) Auto(ctx context.Context, op string, fn func() error)

func (*HTTPNotification) Notify

func (ht *HTTPNotification) Notify(ctx context.Context, record *Notification) error

type Notification

type Notification struct {
	Operation string    `json:"operation"` // backup or prune
	Started   time.Time `json:"started"`
	Finished  time.Time `json:"finished"`
	Failed    bool      `json:"failed"`
	Error     string    `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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