This commit is contained in:
paukstelis
2023-04-06 19:55:03 -04:00
parent 9149a1b790
commit 5f6f5a81ce

View File

@@ -278,11 +278,11 @@ new_instance () {
#find frontend line, do insert #find frontend line, do insert
#Don't know how to do the formatting correctly here. This works, however. #Don't know how to do the formatting correctly here. This works, however.
SEDREPLACE="#$INSTANCE start\n\ SEDREPLACE="#$INSTANCE start\n\
acl is_$INSTANCE url_beg /$INSTANCE\n\ acl is_$INSTANCE url_beg /$INSTANCE\n\
http-request redirect scheme http drop-query append-slash if is_$INSTANCE ! { path_beg /$INSTANCE/ }\n\ http-request redirect scheme http drop-query append-slash if is_$INSTANCE ! { path_beg /$INSTANCE/ }\n\
use_backend $INSTANCE if { path_beg /$INSTANCE/ }\n\ use_backend $INSTANCE if { path_beg /$INSTANCE/ }\n\
#$INSTANCE stop" #$INSTANCE stop"
sed -i "/option forwardfor except 127.0.0.1/a $SEDREPLACE" /etc/haproxy/haproxy.cfg sed -i "/option forwardfor except 127.0.0.1/a $SEDREPLACE" /etc/haproxy/haproxy.cfg
echo "#$INSTANCE start" >> /etc/haproxy/haproxy.cfg echo "#$INSTANCE start" >> /etc/haproxy/haproxy.cfg
@@ -392,13 +392,13 @@ write_camera() {
#find frontend line, do insert #find frontend line, do insert
sed -i "/use_backend $INSTANCE if/a\ use_backend cam${INUM}_$INSTANCE if { path_beg /cam${INUM}_$INSTANCE/ }" /etc/haproxy/haproxy.cfg sed -i "/use_backend $INSTANCE if/a\ use_backend cam${INUM}_$INSTANCE if { path_beg /cam${INUM}_$INSTANCE/ }" /etc/haproxy/haproxy.cfg
if [ $HAversion -gt 1 ]; then if [ $HAversion -gt 1 ]; then
EXTRACAM="backend cam${INUM}_$INSTANCE\n\ EXTRACAM="backend cam${INUM}_$INSTANCE\n\
http-request replace-path /cam${INUM}_$INSTANCE/(.*) /|\1\n\ http-request replace-path /cam${INUM}_$INSTANCE/(.*) /|\1\n\
server webcam1 127.0.0.1:$CAMPORT" server webcam1 127.0.0.1:$CAMPORT"
else else
EXTRACAM="backend cam${INUM}_$INSTANCE\n\ EXTRACAM="backend cam${INUM}_$INSTANCE\n\
reqrep ^([^\ :]*)\ /cam${INUM}_$INSTANCE/(.*) \1\ /|\2 \n\ reqrep ^([^\ :]*)\ /cam${INUM}_$INSTANCE/(.*) \1\ /|\2 \n\
server webcam1 127.0.0.1:$CAMPORT" server webcam1 127.0.0.1:$CAMPORT"
fi fi
echo "#cam${INUM}_$INSTANCE start" >> /etc/haproxy/haproxy.cfg echo "#cam${INUM}_$INSTANCE start" >> /etc/haproxy/haproxy.cfg
@@ -508,7 +508,7 @@ add_camera() {
else else
echo "Camera Port must be greater than 7000" echo "Camera Port must be greater than 7000"
fi fi
fi
done done