This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·67 lines (55 loc) · 1.55 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
getModulePath() {
local module=$1
case $module in
"REDIS_JSON")
echo "/usr/lib/redisjson.so"
;;
"REDIS_SEARCH")
echo "/usr/lib/redisearch.so"
;;
"REDIS_BLOOM")
echo "/usr/lib/redisbloom.so"
;;
"REDIS_TIMESERIES")
echo "/usr/lib/redistimeseries.so"
;;
# Currently not Supported due arm64 and arm/v7 build problems
# "REDIS_GEARS")
# echo "/usr/lib/redisgears.so Plugin /usr/lib/gears_python.so"
# ;;
# "REDIS_AI")
# echo "/usr/lib/redisai.so"
# ;;
"REDIS_GRAPH")
echo "/usr/lib/redisgraph.so"
;;
*)
echo $module
;;
esac
}
DEFAULT_REDIS_MODULES="REDIS_JSON,REDIS_SEARCH"
if [[ $REDIS_MODULES == "" ]]; then
REDIS_MODULES=$DEFAULT_REDIS_MODULES
fi
modules_str=${REDIS_MODULES//";"/","}
readarray -d "," -t modules<<<"$modules_str"
echo "Loading Modules: ${modules[@]}"
command="redis-server"
declare -A parameters
parameters["REDIS_PARAMTERS"]="$REDIS_PARAMTERS"
parameters["REDIS_PASSWORD"]="--requirepass $REDIS_PASSWORD"
parameters["MAXMEMORY"]="--maxmemory $MAXMEMORY"
for parameter_name in "${!parameters[@]}"; do
if [[ ${!parameter_name} != "" ]]; then
command="$command ${parameters[$parameter_name]}"
fi
done
for module in "${modules[@]}"
do
path=$(getModulePath $module)
command="$command --loadmodule $path"
done
echo "Starting Redis with command: $command"
echo ""
$command