diff options
author | Kyle Evans <kevans91@users.noreply.github.com> | 2020-04-30 20:30:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 21:30:31 -0400 |
commit | 1bdffefc052fca440b1d4b59a5e6d402f0836374 (patch) | |
tree | 2aac00ed40e221e8edb12d5c8c0a695a93a461c6 /cmd/dump.go | |
parent | e9e8638f1889daaff159427d48c7ef94e13ff707 (diff) | |
download | gitea-1bdffefc052fca440b1d4b59a5e6d402f0836374.tar.gz gitea-1bdffefc052fca440b1d4b59a5e6d402f0836374.zip |
cmd: dump: add an -L/--skip-log option (#11253)
Not all dumps need to include the logs, in a similar vain to not all dumps
needing to include repositories; these may be subject to different backup
mechanisms/constraints. Add a simple option to let them be excluded from the
dump to simplify workflows that need to exclude them or not collect in the
first place.
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'cmd/dump.go')
-rw-r--r-- | cmd/dump.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/dump.go b/cmd/dump.go index d4461bea93..1d71bc8379 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -52,6 +52,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`, Name: "skip-repository, R", Usage: "Skip the repository dumping", }, + cli.BoolFlag{ + Name: "skip-log, L", + Usage: "Skip the log dumping", + }, }, } @@ -151,7 +155,12 @@ func runDump(ctx *cli.Context) error { } } - if com.IsExist(setting.LogRootPath) { + // Doesn't check if LogRootPath exists before processing --skip-log intentionally, + // ensuring that it's clear the dump is skipped whether the directory's initialized + // yet or not. + if ctx.IsSet("skip-log") && ctx.Bool("skip-log") { + log.Info("Skip dumping log files") + } else if com.IsExist(setting.LogRootPath) { if err := z.AddDir("log", setting.LogRootPath); err != nil { fatal("Failed to include log: %v", err) } |