From eebcadfaf5b057eb6b76735f9c63162c979582f6 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 10 Mar 2023 18:09:57 +0100 Subject: [PATCH] Allow injecting netrc file Signed-off-by: Knut Ahlers --- docker-entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7e42fcc..4172a4f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -6,6 +6,7 @@ set -euo pipefail : ${CHOWN_GID:=${CHOWN_UID}} # ID of the group to chown the repo files to : ${INTERVAL:=300} # How often to sync with remote : ${LOCAL_DIR:=/data} # Where to find the data to backup +: ${NETRC_CONTENT:=} # Content to put into .netrc file, base64 encoded : ${PING_DOWN:=} # Send a ping (HTTP GET) to this URL when an exit-error ocurred : ${PING_MAX_TIME:=5} # Time in seconds to timeout the ping request : ${PING_UP:=} # Send a ping (HTTP GET) to this URL when backup finished successfully @@ -37,6 +38,12 @@ function log() { function main() { pushd "${LOCAL_DIR}" + [[ -z $NETRC_CONTENT ]] || { + info "Creating .netrc from ENV..." + echo "${NETRC_CONTENT}" | base64 -d >~/.netrc + chmod 0600 ~/.netrc + } + info "Marking local dir save..." git config --global --add safe.directory "$(pwd)"