Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d81f563

Browse files
committedMay 17, 2023
Strip away all funky stuff
1 parent aaaa544 commit d81f563

File tree

1 file changed

+9
-33
lines changed

1 file changed

+9
-33
lines changed
 

‎bin/stunnel-conf.sh

+9-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
URLS=${HEROKU_REDIS_BLUE_URL}
3-
n=1
42

53
mkdir -p /app/vendor/stunnel/var/run/stunnel/
64

@@ -16,42 +14,20 @@ ciphers = HIGH:!ADH:!AECDH:!LOW:!EXP:!MD5:!3DES:!SRP:!PSK:@STRENGTH
1614
debug = ${STUNNEL_LOGLEVEL:-notice}
1715
EOFEOF
1816

19-
for URL in $URLS
20-
do
21-
eval URL_VALUE=\$$URL
22-
PARTS=$(echo $URL_VALUE | perl -lne 'print "$1 $2 $3 $4 $5 $6 $7" if /^([^:]+):\/\/([^:]+):([^@]+)@(.*?):(.*?)(\/(.*?)(\\?.*))?$/')
23-
if [ -z "$PARTS" ]
24-
then
25-
PARTS=$(echo $URL_VALUE | perl -lne 'print "$1 $2 $3 $4 $5 $6 $7" if /^([^:]+):\/\/:([^@]+)@(.*?):(.*?)(\/(.*?)(\\?.*))?$/')
26-
WITHOUT_USERNAME=true
27-
fi
28-
URI=( $PARTS )
29-
30-
URI_SCHEME=${URI[0]}
31-
URI_USER=${URI[1]}
32-
URI_PASS=${URI[2]}
33-
URI_HOST=${URI[3]}
34-
URI_PORT=${URI[4]}
35-
36-
echo "URI PARTS"
37-
echo ${URI}
38-
39-
echo "Setting REDIS_URL config var"
40-
export REDIS_URL=redis://$URI_USER:$URI_PASS@127.0.0.1:637${n}
41-
# echo "Setting ${URL}_STUNNEL config var"
42-
# export ${URL}_STUNNEL=$URI_SCHEME://$URI_USER:$URI_PASS@127.0.0.1:637${n}
43-
44-
cat >> /app/vendor/stunnel/stunnel.conf << EOFEOF
17+
REDIS_URL=${HEROKU_REDIS_BLUE_URL/rediss/redis}
18+
REDIS_URL=${REDIS_URL%@*}
19+
REDIS_URL=${REDIS_URL}@127.0.0.1:6371
20+
21+
export REDIS_URL=$REDIS_URL
22+
23+
cat >> /app/vendor/stunnel/stunnel.conf << EOFEOF
4524
[REDIS_URL]
4625
client = yes
47-
accept = 127.0.0.1:637${n}
48-
connect = $URI_HOST:$URI_PORT
26+
accept = 127.0.0.1:6371
27+
connect = ${HEROKU_REDIS_BLUE_URL}
4928
retry = ${STUNNEL_CONNECTION_RETRY:-"no"}
5029
EOFEOF
5130

52-
let "n += 1"
53-
done
54-
5531
cat /app/vendor/stunnel/stunnel.conf
5632
env
5733
chmod go-rwx /app/vendor/stunnel/*

0 commit comments

Comments
 (0)
This repository has been archived.