Skip to content

Commit c9a9106

Browse files
authored
Wireguard override prompt to fix #215 (#238)
1 parent 10a08f4 commit c9a9106

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

templates/scripts/add-vpn-user.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ echo "When it is running you should be able to access internal resources, eg. my
8282
echo "You will be able to connect to resources within both the VPC and the Kubernetes cluster."
8383
echo
8484

85-
# generate client conf
86-
cat <<-EOF > ${CONFIG_FILE}
85+
function generate_wireguard_conf() {
86+
# generate client conf
87+
cat <<-EOF > ${CONFIG_FILE}
8788
#
8889
# This is a generated VPN(wireguard) client configuration
8990
#
@@ -104,4 +105,11 @@ AllowedIPs = $vpc_cidr, $k8s_cidr, $dns_server/32
104105
Endpoint = $EXTERNAL_DNS:51820
105106
106107
EOF
108+
}
107109

110+
if [ -f "$CONFIG_FILE" ]; then
111+
read -e -p "Wireguard config exists, override? (Y/N)" choice
112+
[[ "$choice" == [Yy]* ]] && generate_wireguard_conf || echo cat ${CONFIG_FILE}
113+
else
114+
generate_wireguard_conf
115+
fi

0 commit comments

Comments
 (0)