Skip to content

Commit 71a74ab

Browse files
committed
[BACK-593] Include direct IP list download from Bright Data
1 parent 83a3695 commit 71a74ab

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

entrypoint.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,26 @@ if [[ -z "${PROXY_LIST_URL}" ]]; then
1010
echo "Using mounted proxy list"
1111
touch $BASE_DIR/proxy-list.txt
1212
echo " ---> Done"
13-
else
13+
elif [[ -z "${BRIGHT_DATA_API_TOKEN}"]]; then
1414
echo "Downloading proxy list from $PROXY_LIST_URL"
1515
curl -s $PROXY_LIST_URL > $BASE_DIR/proxy-list.txt
1616
echo " ---> Done"
17+
else
18+
echo "Downloading proxy list from $PROXY_LIST_URL"
19+
curl -s -H "Authorization: Bearer $BRIGHT_DATA_API_TOKEN" "$PROXY_LIST_URL" > $BASE_DIR/proxy-list.txt
20+
echo "Correctly formatting proxy list file"
21+
# Builds the URL with the username, password and the endpoint of Bright Data
22+
SUBSTITUTION_PATTERN="s/^.*/http:\/\/${BRIGHT_DATA_USERNAME}-ip-&:${BRIGHT_DATA_PASSWORD}@brd.superproxy.io:22225/"
23+
sed -i $SUBSTITUTION_PATTERN $BASE_DIR/proxy-list.txt
24+
echo " ---> Done"
1725
fi
1826

19-
echo "Adding proy list to config file"
27+
echo "Adding proxy list to config file"
2028
# Remove blank lines
2129
sed -i '/^$/d' $BASE_DIR/proxy-list.txt
2230
# Prepend forward= in front of each line to match glider config syntax
2331
sed -i 's/^/forward=/' $BASE_DIR/proxy-list.txt
24-
# Randomize and happen
32+
# Randomize and append
2533
cat $BASE_DIR/proxy-list.txt | shuf >> $BASE_DIR/glider.conf
2634
echo " ---> Done"
2735

0 commit comments

Comments
 (0)