Skip to content

Commit 6cf4760

Browse files
authored
Merge pull request #52 from Collaborne/pr/re-match-indices
Fix the CN and port match extraction
2 parents c740012 + ad61827 commit 6cf4760

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ addArg "--config" "$OVPN_CONFIG"
1010
# Server name is in the form "udp://vpn.example.com:1194"
1111
if [[ "$OVPN_SERVER_URL" =~ ^((udp|tcp)(4|6)?://)?([0-9a-zA-Z\.\-]+)(:([0-9]+))?$ ]]; then
1212
OVPN_PROTO=${BASH_REMATCH[2]};
13-
OVPN_CN=${BASH_REMATCH[3]};
14-
OVPN_PORT=${BASH_REMATCH[5]};
13+
OVPN_CN=${BASH_REMATCH[4]};
14+
OVPN_PORT=${BASH_REMATCH[6]};
1515
else
1616
echo "Need to pass in OVPN_SERVER_URL in 'proto://fqdn:port' format"
1717
exit 1

kube/deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ podcidr=$4
1010
# Server name is in the form "udp://vpn.example.com:1194"
1111
if [[ "$serverurl" =~ ^((udp|tcp)(4|6)?://)?([0-9a-zA-Z\.\-]+)(:([0-9]+))?$ ]]; then
1212
OVPN_PROTO=$(echo ${BASH_REMATCH[2]} | tr '[:lower:]' '[:upper:]')
13-
OVPN_CN=$(echo ${BASH_REMATCH[3]} | tr '[:upper:]' '[:lower:]')
14-
OVPN_PORT=${BASH_REMATCH[5]};
13+
OVPN_CN=$(echo ${BASH_REMATCH[4]} | tr '[:upper:]' '[:lower:]')
14+
OVPN_PORT=${BASH_REMATCH[6]};
1515
else
1616
echo "Need to pass in OpenVPN URL in 'proto://fqdn:port' format"
1717
echo "eg: tcp://my.fully.qualified.domain.com:1194"

0 commit comments

Comments
 (0)