-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint
executable file
·61 lines (50 loc) · 1.26 KB
/
entrypoint
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
#!/bin/bash
set -e
NGINX_TEMPLATE=/etc/nginx/nginx.conf.template
NGINX_CONF=/etc/nginx/nginx.conf
ENV_OK=0
if [ -n "${PERISCOPE_KEY}" ]; then
echo "Periscope activate."
sed -i 's|#periscope|push '"$PERISCOPE_URL"'${PERISCOPE_KEY};|g' $NGINX_TEMPLATE
ENV_OK=1
else
sed -i 's|#periscope| |g' $NGINX_TEMPLATE
fi
if [ -n "${TWITCH_KEY}" ]; then
echo "Twitch activate."
sed -i 's|#twitch|push '"$TWITCH_URL"'${TWITCH_KEY};|g' $NGINX_TEMPLATE
ENV_OK=1
else
sed -i 's|#twitch| |g' $NGINX_TEMPLATE
fi
if [ -n "${YOUTUBE_KEY}" ]; then
echo "Youtube activate."
sed -i 's|#youtube|push '"$YOUTUBE_URL"'${YOUTUBE_KEY};|g' $NGINX_TEMPLATE
ENV_OK=1
else
sed -i 's|#youtube| |g' $NGINX_TEMPLATE
fi
if [ -n "${FACEBOOK_KEY}" ]; then
echo "Facebook activate."
sed -i 's|#facebook|push '"$FACEBOOK_URL"'${FACEBOOK_KEY};|g' $NGINX_TEMPLATE
ENV_OK=1
else
sed -i 's|#facebook| |g' $NGINX_TEMPLATE
fi
if [ -n "${INSTAGRAM_KEY}" ]; then
echo "Instagram activate."
sed -i 's|#instagram|push '"$INSTAGRAM_URL"'${INSTAGRAM_KEY};|g' $NGINX_TEMPLATE
ENV_OK=1
else
sed -i 's|#instagram| |g' $NGINX_TEMPLATE
fi
if [ $ENV_OK -eq 1 ]; then
envsubst < $NGINX_TEMPLATE > $NGINX_CONF
else
echo "Start local server."
fi
if [ -n "${DEBUG}" ]; then
echo $NGINX_CONF
cat $NGINX_CONF
fi
exec "$@"