diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8229ddbe2..77091d8d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ All notable changes to Gogs are documented in this file.
- New configuration option `[server] SSH_SERVER_MACS` for setting list of accepted MACs for connections to builtin SSH server. [#6434](https://github.com/gogs/gogs/issues/6434)
- Support specifying custom schema for PostgreSQL. [#6695](https://github.com/gogs/gogs/pull/6695)
- Support rendering Mermaid diagrams in Markdown. [#6776](https://github.com/gogs/gogs/pull/6776)
+- Docker: Allow passing extra arguments to the `backup` command. [#7060](https://github.com/gogs/gogs/pull/7060)
- New languages support: Mongolian, Romanian. [#6510](https://github.com/gogs/gogs/pull/6510) [#7082](https://github.com/gogs/gogs/pull/7082)
### Changed
diff --git a/docker/README.md b/docker/README.md
index 47946d5bc..fb193e36d 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -120,6 +120,14 @@ This container has some options available via environment variables, these optio
- Action:
Used by backup system. If defined, supplies `--exclude-repos` argument to `gogs backup`.\
See: [Backup System](#backup-system)
+- **BACKUP_EXTRA_ARGS**:
+ - Possible value:
+ `--verbose --exclude-mirror-repos`
+ - Default:
+ `null`
+ - Action:
+ Used by backup system. If defined, append content to arguments to `gogs backup`.\
+ See: [Backup System](#backup-system)
## Backup system
diff --git a/docker/runtime/backup-job.sh b/docker/runtime/backup-job.sh
index 2b8efd70b..684cc3d7e 100644
--- a/docker/runtime/backup-job.sh
+++ b/docker/runtime/backup-job.sh
@@ -4,6 +4,7 @@ execute_backup_job() {
BACKUP_ARG_PATH="${1:-}"
BACKUP_ARG_CONFIG="${BACKUP_ARG_CONFIG:-}"
BACKUP_ARG_EXCLUDE_REPOS="${BACKUP_ARG_EXCLUDE_REPOS:-}"
+ BACKUP_EXTRA_ARGS="${BACKUP_EXTRA_ARGS:-}"
cd "/app/gogs" || exit 1
BACKUP_ARGS="--target=${BACKUP_ARG_PATH}"
@@ -16,7 +17,13 @@ execute_backup_job() {
BACKUP_ARGS="${BACKUP_ARGS} --exclude-repos=${BACKUP_ARG_EXCLUDE_REPOS}"
fi
- ./gogs backup "${BACKUP_ARGS}" || echo "Error: Backup job returned non-successful code." && exit 1
+ if [ -n "${BACKUP_EXTRA_ARGS}" ]; then
+ BACKUP_ARGS="${BACKUP_ARGS} ${BACKUP_EXTRA_ARGS}"
+ fi
+
+ # NOTE: We actually need word splitting to be able to pass multiple arguments.
+ # shellcheck disable=SC2086
+ ./gogs backup ${BACKUP_ARGS} || echo "Error: Backup job returned non-successful code." && exit 1
}
main() {