-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
35 lines (29 loc) · 882 Bytes
/
docker-entrypoint.sh
File metadata and controls
35 lines (29 loc) · 882 Bytes
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
#!/usr/bin/env sh
set -eu
# Enable debug mode if DEBUG environment variable is set to "true"
if [ "${DEBUG:-false}" = "true" ]; then
set -x
fi
log() {
# Simple log format with timestamp
printf '[entrypoint] %s\n' "$*" >&2
}
log "Starting entrypoint script..."
# Check if --host argument is not provided and the LEAFWIKI_HOST environment variable is not set.
# if both are missing, set LEAFWIKI_HOST to "0.0.0.0"
has_host_arg=false
for arg in "$@"; do
case "$arg" in
--host|--host=* )
has_host_arg=true
break
;;
esac
done
if [ "$has_host_arg" = false ] && [ -z "${LEAFWIKI_HOST:-}" ]; then
log "No --host argument or LEAFWIKI_HOST environment variable found. Setting LEAFWIKI_HOST to '0.0.0.0'"
export LEAFWIKI_HOST="0.0.0.0"
fi
# start the main application and pass all arguments to it
log "Executing /app/leafwiki"
exec /app/leafwiki "$@"