openvpn: use also append for dev_type and ovpnproto options

There is already the 'append' command, which assembles all parameters that
are called 'proto_run_command'. Let´s use that. To ensure that the
sequence is correct, the parameters must be added at the beginning, so that
user parameters can overwrite them.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2026-03-05 13:28:11 +01:00
committed by Florian Eckert
parent f89b656de2
commit be20045045

View File

@@ -101,6 +101,11 @@ proto_openvpn_setup() {
exec_params=
json_get_var dev_type dev_type
[ -z "$dev_type" ] && append exec_params " --dev-type tun"
json_get_var ovpnproto ovpnproto
[ -n "$ovpnproto" ] && append exec_params " --proto $ovpnproto"
# alllow deprecated OpenVPN configuration values by default
json_get_var ALLOW_DEPRECATED allow_deprecated
[ -z "$ALLOW_DEPRECATED" ] && ALLOW_DEPRECATED=0
@@ -150,12 +155,8 @@ proto_openvpn_setup() {
# Testing option
# ${tls_exit:+--tls-exit} \
json_get_var dev_type dev_type
json_get_var ovpnproto ovpnproto
# shellcheck disable=SC2086
proto_run_command "$config" openvpn \
$([ -z "$dev_type" ] && echo " --dev-type tun") \
$([ -z "$ovpnproto" ] && echo " --proto $ovpnproto") \
--cd "$cd_dir" \
--status "/var/run/openvpn.$config.status" \
--syslog "openvpn_$config" \