Browse Source

b64 fix

master
gsd 3 weeks ago
parent
commit
d9bbc631e2
  1. 12
      entrypoint.sh

12
entrypoint.sh

@ -3,11 +3,11 @@
#htpasswd part #htpasswd part
rm /etc/nginx/.htpasswd || echo "cleared" rm /etc/nginx/.htpasswd || echo "cleared"
touch /etc/nginx/.htpasswd touch /etc/nginx/.htpasswd
USERS_SPLIT=$(echo -n \"$COMBO\" | tr ";" "\n") USERS_SPLIT=$(echo -n $COMBO | tr ";" "\n")
for USER in $USERS_SPLIT for USER in $USERS_SPLIT
do do
USERNAME=$(echo -n \"$USER\" | cut -d ":" -f 1) USERNAME=$(echo -n $USER | cut -d ":" -f 1)
PASSWORD=$(echo -n \"$USER\" | cut -d ":" -f 2) PASSWORD=$(echo -n $USER | cut -d ":" -f 2 | head -c-1)
htpasswd -b /etc/nginx/.htpasswd $USERNAME $PASSWORD htpasswd -b /etc/nginx/.htpasswd $USERNAME $PASSWORD
done done
@ -15,14 +15,14 @@ done
#gateway_0 is main #gateway_0 is main
rm /etc/nginx/conf.d/srv.conf || echo "cleared" rm /etc/nginx/conf.d/srv.conf || echo "cleared"
touch /etc/nginx/conf.d/srv.conf touch /etc/nginx/conf.d/srv.conf
GATEWAYS_SPLIT=$(echo -n \"$GATEWAY\" | tr ";" "\n") GATEWAYS_SPLIT=$(echo -n $GATEWAY | tr ";" "\n")
COUNTER=0 COUNTER=0
for GATEWAY in $GATEWAYS_SPLIT for GATEWAY in $GATEWAYS_SPLIT
do do
cat <<EOT >> /etc/nginx/conf.d/srv.conf cat <<EOT >> /etc/nginx/conf.d/srv.conf
upstream gateway_$COUNTER { upstream gateway_$COUNTER {
server $(echo -n \"$GATEWAY\" | cut -d "|" -f 1); server $(echo -n $GATEWAY | cut -d "|" -f 1);
} }
EOT EOT
@ -90,7 +90,7 @@ if [ $COUNTER -gt 0 ]; then
rewrite /.* \$request_uri break; rewrite /.* \$request_uri break;
proxy_pass http://gateway_$COUNTER; proxy_pass http://gateway_$COUNTER;
proxy_set_header X-Is-Mirror 'yes'; proxy_set_header X-Is-Mirror 'yes';
proxy_set_header Authorization "Basic $(echo -n \"$GATEWAY\" | cut -d "|" -f 2 | base64)"; proxy_set_header Authorization "Basic $(echo -n $GATEWAY | cut -d "|" -f 2 -s | head -c-1 | base64)";
limit_except POST { limit_except POST {
deny all; deny all;

Loading…
Cancel
Save