forked from bankiru/docker-git-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-daemon.sh
executable file
·37 lines (27 loc) · 911 Bytes
/
git-daemon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
#* STRICT_PATHS : 0 or 1, default 0
#* INIT_TIMEOUT : numeric, 0 - use git default value
#* TIMEOUT : numeric, 0 - use git default value
#* MAX_CONNECTIONS : numeric, default 32
#* VERBOSE : 0 or 1, default 0
#* REUSEADDR : 0 or 1, default 1
ARGS=""
if [[ "${STRICT_PATHS}" == "1" ]]; then
ARGS="${ARGS} --strict-paths"
fi
if [ -z "${REUSEADDR}" ] || [ "${REUSEADDR}" == "1" ]; then
ARGS="${ARGS} --reuseaddr"
fi
if [ -z "${VERBOSE}" ] || [ "${VERBOSE}" == "1" ]; then
ARGS="${ARGS} --verbose"
fi
if [ -n "${INIT_TIMEOUT}" ]; then
ARGS="${ARGS} --init-timeout=${TIMEOUT}"
fi
if [ -n "${TIMEOUT}" ]; then
ARGS="${ARGS} --timeout=${TIMEOUT}"
fi
if [ -n "${MAX_CONNECTIONS}" ]; then
ARGS="${ARGS} --max-connections=${MAX_CONNECTIONS}"
fi
git daemon --export-all --base-path=/opt/git --base-path-relaxed --listen=0.0.0.0 --port=9418 ${ARGS}