openvpn: use common pattern for global variable
authorFlorian Eckert <redacted>
Thu, 5 Mar 2026 08:19:15 +0000 (09:19 +0100)
committerFlorian Eckert <redacted>
Wed, 11 Mar 2026 13:22:41 +0000 (14:22 +0100)
The common pattern for global variable is, to write the variable name in
capital letters. This improves maintainability in shell scripts.

Signed-off-by: Florian Eckert <redacted>
net/openvpn/files/lib/netifd/proto/openvpn.sh

index b94a80d573918b1f7f0678b15ee38c43a25a9125..6025a38739e92d643c232fe57455f6573d4dde0c 100755 (executable)
@@ -37,7 +37,7 @@ option_builder() {
                                list) proto_config_add_array "$f:list" ;;
                        esac
                elif [ "$action" = "build" ]; then
-                       [ "${f#*:}" = "d" ] && [ "$allow_deprecated" = 0 ] && continue
+                       [ "${f#*:}" = "d" ] && [ "$ALLOW_DEPRECATED" = 0 ] && continue
                        case "$opt_type" in
                                bool)
                                        json_get_var v "$f"
@@ -97,12 +97,13 @@ proto_openvpn_init_config() {
 
 proto_openvpn_setup() {
        local config="$1"
-       local allow_deprecated exec_params
-       allow_deprecated=0
+       local exec_params
 
        exec_params=
 
-       json_get_var allow_deprecated allow_deprecated
+       # alllow deprecated OpenVPN configuration values by default
+       json_get_var ALLOW_DEPRECATED allow_deprecated
+       [ -z "$ALLOW_DEPRECATED" ] && ALLOW_DEPRECATED=0
 
        # Build exec params from configured options we get from ubus values stored during init_config
        option_builder build OPENVPN_BOOLS bool
git clone https://git.99rst.org/PROJECT