This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
entrypoint.sh
103 lines (86 loc) · 4.15 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
set -e
source ~/.bash_profile
run() {
sed -i -e "s,<url_transcode>,$URL_TRANSCODE,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<url_live>,$URL_LIVE,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<stream_specifier>,$STREAM_SPECIFIER,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<private_key>,$PRIVATE_KEY,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<twitch_url>,$TWITCH_URL,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<hitbox_url>,$HITBOX_URL,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<youtube_url>,$YOUTUBE_URL,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<dailymotion_url>,$DAILYMOTION_URL,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<livecoding_url>,$LIVECODING_URL,g" /usr/local/nginx-streaming/conf/nginx.conf
echo "==============================================================================================="
echo "="
if [[ $TWITCH_STREAMKEY != "NULL" ]]
then
echo "= TWITCH_STREAMKEY : $TWITCH_STREAMKEY"
sed -i -e "s,<twitch_active>, ,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<twitch_streamkey>,$TWITCH_STREAMKEY,g" /usr/local/nginx-streaming/conf/nginx.conf
else
echo "= TWITCH_STREAMKEY : NOT FOUND!"
sed -i -e "s,<twitch_active>,#,g" /usr/local/nginx-streaming/conf/nginx.conf
fi
if [[ $HITBOX_STREAMKEY != "NULL" ]]
then
echo "= HITBOX_STREAMKEY : $HITBOX_STREAMKEY"
sed -i -e "s,<hitbox_active>, ,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<hitbox_streamkey>,$HITBOX_STREAMKEY,g" /usr/local/nginx-streaming/conf/nginx.conf
else
echo "= HITBOX_STREAMKEY : NOT FOUND!"
sed -i -e "s,<hitbox_active>,#,g" /usr/local/nginx-streaming/conf/nginx.conf
fi
if [[ $YOUTUBE_STREAMKEY != "NULL" ]]
then
echo "= YOUTUBE_STREAMKEY : $YOUTUBE_STREAMKEY"
sed -i -e "s,<youtube_active>, ,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<youtube_streamkey>,$YOUTUBE_STREAMKEY,g" /usr/local/nginx-streaming/conf/nginx.conf
else
echo "= YOUTUBE_STREAMKEY : NOT FOUND!"
sed -i -e "s,<youtube_active>,#,g" /usr/local/nginx-streaming/conf/nginx.conf
fi
if [[ $DAILYMOTION_STREAMKEY != "NULL" ]]
then
echo "= DAILYMOTION_STREAMKEY : $DAILYMOTION_STREAMKEY"
sed -i -e "s,<dailymotion_active>, ,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<dailymotion_streamkey>,$DAILYMOTION_STREAMKEY,g" /usr/local/nginx-streaming/conf/nginx.conf
else
echo "= DAILYMOTION_STREAMKEY : NOT FOUND!"
sed -i -e "s,<dailymotion_active>,#,g" /usr/local/nginx-streaming/conf/nginx.conf
fi
if [[ $LIVECODING_STREAMKEY != "NULL" ]]
then
echo "= LIVECODING_STREAMKEY : $LIVECODING_STREAMKEY"
sed -i -e "s,<livecoding_active>, ,g" /usr/local/nginx-streaming/conf/nginx.conf
sed -i -e "s,<livecoding_streamkey>,$LIVECODING_STREAMKEY,g" /usr/local/nginx-streaming/conf/nginx.conf
else
echo "= LIVECODING_STREAMKEY : NOT FOUND!"
sed -i -e "s,<livecoding_active>,#,g" /usr/local/nginx-streaming/conf/nginx.conf
fi
today=$(date +%s)
expire=$(($today+$EXPIRATION_TOKEN))
token=$(echo -n "$PRIVATE_KEY/stream$expire" | openssl dgst -md5 -binary |
openssl enc -base64 | tr '+/' '-_' | tr -d '=')
formatted_date=$(date --date="@$expire" +"%m-%d-%Y %r")
echo "="
echo "= Mobile files = http://$YOUR_IP/"
echo "= URL live = rtmp://$YOUR_IP:1935/$URL_LIVE/"
echo "= URL transcode = rtmp://$YOUR_IP:1935/$URL_TRANSCODE/"
echo "= Stream Key = stream?e=$expire&st=$token"
echo "= Expiration token = $formatted_date (in $EXPIRATION_TOKEN sec.) "
echo "="
echo "==============================================================================================="
chown docker /src -Rf
supervisord
}
case "$1" in
"run")
echo "Run"
run
;;
*)
echo "Custom command : $@"
exec "$@"
;;
esac