Compare commits

..

4 Commits

Author SHA1 Message Date
Frederik Ring
5f3832d621 Consider prefix rules when pruning WebDAV storages (#79) 2022-03-05 13:33:15 +01:00
Frederik Ring
4b1127b8c4 Document BACKUP_SOURCES 2022-03-04 19:57:32 +01:00
Frederik Ring
ae50a3ac4f Add attribution to code taken from moby repository 2022-03-04 16:40:34 +01:00
Frederik Ring
bad22eee93 Fix syntax highlighting in container 2022-03-04 14:08:31 +01:00
3 changed files with 13 additions and 1 deletions

View File

@@ -156,6 +156,11 @@ You can populate below template according to your requirements and use it as you
# BACKUP_FROM_SNAPSHOT="false"
# By default, the `/backup` directory inside the container will be backed up.
# In case you need to use a custom location, set `BACKUP_SOURCES`.
# BACKUP_SOURCES="/other/location"
########### BACKUP STORAGE
# The name of the remote bucket that should be used for storing backups. If
@@ -658,7 +663,7 @@ In case you are using a socket proxy, it must support `GET` and `POST` requests
Multiple backup schedules with different configuration can be configured by mounting an arbitrary number of configuration files (using the `.env` format) into `/etc/dockervolumebackup/conf.d`:
```
```yml
version: '3'
services:

View File

@@ -1,6 +1,9 @@
// Copyright 2022 - Offen Authors <hioffen@posteo.de>
// SPDX-License-Identifier: MPL-2.0
// Portions of this file are taken and adapted from `moby`, Copyright 2012-2017 Docker, Inc.
// Licensed under the Apache 2.0 License: https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/LICENSE
package main
import (

View File

@@ -12,6 +12,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"text/template"
"time"
@@ -580,6 +581,9 @@ func (s *script) pruneBackups() error {
var matches []fs.FileInfo
var lenCandidates int
for _, candidate := range candidates {
if !strings.HasPrefix(candidate.Name(), s.c.BackupPruningPrefix) {
continue
}
lenCandidates++
if candidate.ModTime().Before(deadline) {
matches = append(matches, candidate)