-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·53 lines (39 loc) · 1016 Bytes
/
entrypoint.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
set -e
write_config() {
ACL_DISABLED=${ACL_DISABLED:-\"DEBUG\", \"FLUSHDB\", \"FLUSHALL\"}
ACL_HTTP_BASIC_AUTH_ENABLED=${ACL_HTTP_BASIC_AUTH_ENABLED:-\"DEBUG\"}
[ -n "$REDIS_PORT" ] && REDIS_PORT=${REDIS_PORT##*:}
cat - <<EOF
{
"redis_host": "${REDIS_HOST:-redis}",
"redis_port": ${REDIS_PORT:-6379},
"redis_auth": ${REDIS_AUTH:-null},
"http_host": "${HTTP_HOST:-0.0.0.0}",
"http_port": ${HTTP_PORT:-7379},
"threads": ${THREADS:-5},
"pool_size": ${POOL_SIZE:-10},
"daemonize": false,
"websockets": ${WEBSOCKETS:-false},
"database": ${DATABASE:-0},
"acl": [
{
"disabled": [${ACL_DISABLED}]
},
{
"http_basic_auth": "${ACL_HTTP_BASIC_AUTH:-user:password}",
"enabled": [${ACL_HTTP_BASIC_AUTH_ENABLED}]
}
],
"verbosity": ${VERBOSITY:-99},
"logfile": "${LOGFILE:-/dev/stdout}"
}
EOF
}
if [ $# -eq 0 ]; then
echo "writing config.." >&2
write_config > ./webdis.json
echo "starting webdis.." >&2
webdis ./webdis.json
fi
exec "$@"