-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
70 lines (58 loc) · 2.39 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
70 lines (58 loc) · 2.39 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# docker-entrypoint.sh – translates environment variables into CLI flags and
# launches either the terminal dashboard or the web dashboard.
set -e
# ── helpers ────────────────────────────────────────────────────────────────────
build_cli_args() {
ARGS=""
# --interval
if [ -n "${SIGNALSCOPE_INTERVAL}" ]; then
ARGS="${ARGS} --interval ${SIGNALSCOPE_INTERVAL}"
fi
# --top
if [ -n "${SIGNALSCOPE_TOP}" ]; then
ARGS="${ARGS} --top ${SIGNALSCOPE_TOP}"
fi
# --cpu-threshold
if [ -n "${SIGNALSCOPE_CPU_THRESHOLD}" ]; then
ARGS="${ARGS} --cpu-threshold ${SIGNALSCOPE_CPU_THRESHOLD}"
fi
# --mem-threshold
if [ -n "${SIGNALSCOPE_MEM_THRESHOLD}" ]; then
ARGS="${ARGS} --mem-threshold ${SIGNALSCOPE_MEM_THRESHOLD}"
fi
# --no-daemon
if [ "${SIGNALSCOPE_NO_DAEMON}" = "true" ] || [ "${SIGNALSCOPE_NO_DAEMON}" = "1" ]; then
ARGS="${ARGS} --no-daemon"
fi
# --user
if [ -n "${SIGNALSCOPE_USER}" ]; then
ARGS="${ARGS} --user ${SIGNALSCOPE_USER}"
fi
# --alert-log
if [ -n "${SIGNALSCOPE_ALERT_LOG}" ]; then
ARGS="${ARGS} --alert-log ${SIGNALSCOPE_ALERT_LOG}"
fi
# --log-level
if [ -n "${SIGNALSCOPE_LOG_LEVEL}" ]; then
ARGS="${ARGS} --log-level ${SIGNALSCOPE_LOG_LEVEL}"
fi
echo "${ARGS}"
}
# ── dispatch ───────────────────────────────────────────────────────────────────
if [ "${SIGNALSCOPE_MODE}" = "web" ]; then
echo "Starting SignalScope web dashboard on ${SIGNALSCOPE_WEB_HOST}:${SIGNALSCOPE_WEB_PORT} …"
exec python -m src.web.app \
--host "${SIGNALSCOPE_WEB_HOST}" \
--port "${SIGNALSCOPE_WEB_PORT}" \
--interval "${SIGNALSCOPE_INTERVAL}" \
--cpu-threshold "${SIGNALSCOPE_CPU_THRESHOLD}" \
--mem-threshold "${SIGNALSCOPE_MEM_THRESHOLD}" \
${SIGNALSCOPE_TOP:+--top "${SIGNALSCOPE_TOP}"} \
${SIGNALSCOPE_NO_DAEMON:+--no-daemon} \
${SIGNALSCOPE_USER:+--user "${SIGNALSCOPE_USER}"} \
--log-level "${SIGNALSCOPE_LOG_LEVEL}"
else
# shellcheck disable=SC2046
exec python -m src.main $(build_cli_args)
fi