-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_run
More file actions
executable file
·37 lines (28 loc) · 1.03 KB
/
Copy pathdocker_run
File metadata and controls
executable file
·37 lines (28 loc) · 1.03 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
#!/bin/bash
replace_env() {
# while read line;
# do
# # List our env variables and split them with =
# parsed="$(cut -d'=' -f2 <<<"$line")"
# curvar="$(echo $parsed | sed 's|\$||g')"
# eval actualval=\$$curvar
# echo "$parsed -> $actualval"
# sed -i "s|$parsed|$actualval|g" $1
# done < ./.env.schema
while IFS='=' read -r -d '' n v; do
sed -i "s|"'$'"$n|$v|g" $1
# printf "'%s'='%s'\n" "$n" "$v"
done < <(env -0)
}
replace_env /usr/local/etc/redis/redis.conf
if [ "$REDIS_REPLICA_MODE" == "replica" ]; then
replace_env /usr/local/etc/redis/redis.replica.conf
cat /usr/local/etc/redis/redis.replica.conf >> /usr/local/etc/redis/redis.conf
# if REPLICA_IS_DYNAMIC true then
public_ip=$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com -4)
# else use $REPLICA_PUBLIC_IP
echo $public_ip
echo "replica-announce-ip $public_ip" >> /usr/local/etc/redis/redis.conf
echo "replica-announce-port ${REDIS_PUBLISHED_PORT:-6379}" >> /usr/local/etc/redis/redis.conf
fi
redis-server /usr/local/etc/redis/redis.conf