mirror of
https://kolaente.dev/konrad/docker-db-backup.git
synced 2026-01-10 02:50:08 +01:00
feat: move running the actual dump command to the db container
This commit is contained in:
7
dump.go
7
dump.go
@@ -2,11 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/client"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Dumper interface {
|
||||
Dump() error
|
||||
Dump(c *client.Client) error
|
||||
}
|
||||
|
||||
func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
|
||||
@@ -22,12 +23,12 @@ func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
|
||||
return nil
|
||||
}
|
||||
|
||||
func dumpAllDatabases() error {
|
||||
func dumpAllDatabases(c *client.Client) error {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
|
||||
for _, dumper := range store {
|
||||
err := dumper.Dump()
|
||||
err := dumper.Dump(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user