1
1
mirror of https://github.com/angristan/wireguard-install.git synced 2024-06-05 04:50:49 +00:00

add check for secondary DNS

Added a quick if statement to check for a secondary DNS server. If left with the default or provided with one, uses it. Otherwise, eliminates trailing comma from DNS variable assignment.
This commit is contained in:
Chris Lewicki 2020-05-05 19:55:53 -04:00 committed by GitHub
parent 2e492d263a
commit 23b9ad0459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,14 @@ function addClient() {
echo "[Interface]
PrivateKey = $CLIENT_PRIV_KEY
Address = $CLIENT_WG_IPV4/24,$CLIENT_WG_IPV6/64
DNS = $CLIENT_DNS_1,$CLIENT_DNS_2
# Fix for bug where trailing comma is left if no secondary DNS specified
if [ -z "$CLIENT_DNS_2" ]
then
DNS = $CLIENT_DNS_1,$CLIENT_DNS_2
else
DNS = $CLIENT_DNS_1
fi
[Peer]
PublicKey = $SERVER_PUB_KEY