summaryrefslogtreecommitdiff
path: root/entrypoint.sh
blob: 2a43a24ba64ca772ade63b3c72a746caacd7075f (plain)
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
#!/bin/sh

# Export all used variables
export CGITRC_CLONE_PREFIX="${CGITRC_CLONE_PREFIX:-""}"
export CGITRC_ENABLE_HTTP_CLONE="${CGITRC_ENABLE_HTTP_CLONE:-"1"}"
export CGITRC_ENABLE_LOG_FILECOUNT="${CGITRC_ENABLE_LOG_LINECOUNT:-"1"}"
export CGITRC_ENABLE_LOG_LINECOUNT="${CGITRC_ENABLE_LOG_FILECOUNT:-"1"}"
export CGITRC_ROOT_DESC="${CGITRC_ROOT_DESC:-"Nondescript"}"
export CGITRC_ROOT_TITLE="${CGITRC_ROOT_TILE:-"Git repository browser"}"
export CGITRC_SCAN_PATH="${CGITRC_SCAN_PATH:-"/srv/git"}"
export CGITRC_SNAPSHOTS="${CGITRC_SNAPSHOTS:-"tar.gz"}"
export HOSTNAME="${HOSTNAME:-"$(hostname -f)"}"
export HTTPD_LISTEN_PORT="${HTTPD_LISTEN_PORT:-"80"}"

# Output debugging info
env | grep '^CGITRC_' | sort
env | grep '^HTTPD_' | sort

# Turn templates into proper files
envsubst \
	< "/etc/apache2/httpd.conf.template" \
	> "/etc/apache2/httpd.conf"

envsubst \
	< "/etc/cgitrc.template" \
	> "/etc/cgitrc"

# Run apache2
exec /usr/sbin/httpd -D FOREGROUND