Browse Source

Merge pull request #105 from YunoHost-Apps/dns_method_yunohost

Use default DNS resolvers from Yunohost when DNS settings are empty
Alexandre Aubin 1 year ago
parent
commit
eb0d60fa22
1 changed files with 7 additions and 2 deletions
  1. 7 2
      scripts/config

+ 7 - 2
scripts/config

@@ -238,9 +238,14 @@ ynh_app_config_validate() {
         crt_client="$(read_cube $config_file crt_client)"
         crt_client_key="$(read_cube $config_file crt_client_key)"
         crt_client_ta="$(read_cube $config_file crt_client_ta)"
-        dns_method="custom"
-        nameservers="$dns0,$dns1"
 
+        if [[ -z "$dns0" && -z "$dns1" ]]; then
+          dns_method="yunohost"
+        else
+          dns_method="custom"
+          nameservers="$dns0,$dns1"
+        fi
+        
         # Build specific OVPN template
         tmp_dir=$(dirname "${config_file}")
         cp -f /etc/yunohost/apps/vpnclient/conf/openvpn_client.conf.tpl $tmp_dir/client.conf.tpl