Parcourir la source

Handling of turn port in nginx

Bob Mottram il y a 8 ans
Parent
révision
433c502718
1 fichiers modifiés avec 14 ajouts et 5 suppressions
  1. 14
    5
      src/freedombone-app-matrix

+ 14
- 5
src/freedombone-app-matrix Voir le fichier

48
                   DEFAULT_DOMAIN_NAME)
48
                   DEFAULT_DOMAIN_NAME)
49
 
49
 
50
 function matrix_nginx {
50
 function matrix_nginx {
51
-    matrix_proxy_str=' \
51
+    matrix_proxy_str=" \
52
     location /matrix { \
52
     location /matrix { \
53
-        proxy_pass https://localhost:8448; \
53
+        proxy_pass https://localhost:${MATRIX_PORT}; \
54
         proxy_buffering on; \
54
         proxy_buffering on; \
55
-    }'
55
+    }"
56
+    turn_proxy_str=" \
57
+    location /turn { \
58
+        proxy_pass https://localhost:${TURN_PORT}; \
59
+        proxy_buffering on; \
60
+    }"
56
 
61
 
57
     if [ ! -f /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} ]; then
62
     if [ ! -f /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} ]; then
58
         matrix_nginx_site=/etc/nginx/sites-available/$DEFAULT_DOMAIN_NAME
63
         matrix_nginx_site=/etc/nginx/sites-available/$DEFAULT_DOMAIN_NAME
131
         nginx_ensite $DEFAULT_DOMAIN_NAME
136
         nginx_ensite $DEFAULT_DOMAIN_NAME
132
     fi
137
     fi
133
 
138
 
134
-    if ! grep 'localhost:8448' /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
139
+    if ! grep "localhost:${MATRIX_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
135
         sed -i "s|:443 ssl;|:443 ssl;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
140
         sed -i "s|:443 ssl;|:443 ssl;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
136
         sed -i "s| default_server;| default_server;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
141
         sed -i "s| default_server;| default_server;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
137
     fi
142
     fi
143
+    if ! grep 'localhost:${TURN_PORT}' /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
144
+        sed -i "s|:443 ssl;|:443 ssl;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
145
+        sed -i "s| default_server;| default_server;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
146
+    fi
138
 
147
 
139
     systemctl restart nginx
148
     systemctl restart nginx
140
 }
149
 }
156
 
165
 
157
     local ymltemp="$(mktemp)"
166
     local ymltemp="$(mktemp)"
158
 
167
 
159
-    awk -v TURNURIES="turn_uris: [\"turn:${DEFAULT_DOMAIN_NAME}:${TURN_PORT}?transport=udp\", \"turn:${DEFAULT_DOMAIN_NAME}:${TURN_PORT}?transport=tcp\"]" \
168
+    awk -v TURNURIES="turn_uris: [\"turn:${DEFAULT_DOMAIN_NAME}/turn?transport=udp\", \"turn:${DEFAULT_DOMAIN_NAME}/turn?transport=tcp\"]" \
160
         -v TURNSHAREDSECRET="turn_shared_secret: \"${turnkey}\"" \
169
         -v TURNSHAREDSECRET="turn_shared_secret: \"${turnkey}\"" \
161
         -v PIDFILE="pid_file: ${MATRIX_DATA_DIR}/homeserver.pid" \
170
         -v PIDFILE="pid_file: ${MATRIX_DATA_DIR}/homeserver.pid" \
162
         -v DATABASE="database: \"${MATRIX_DATA_DIR}/homeserver.db\"" \
171
         -v DATABASE="database: \"${MATRIX_DATA_DIR}/homeserver.db\"" \