Skip to content

Conversation

@Adityashandilya555
Copy link
Contributor

@Adityashandilya555 Adityashandilya555 commented Oct 6, 2025

…rt #227

Changed VPN_* environment variables to OPENVPN_* to distinguish them from upcoming WireGuard VPN configurations. This prepares the codebase for WireGuard support by making OpenVPN-specific variables clearly identifiable.

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #227

Description of Changes

  • VPN_DOMAIN → OPENVPN_DOMAIN
  • VPN_NAME → OPENVPN_NAME
  • VPN_CLIENT_NAME → OPENVPN_CLIENT_NAME

Updated across configuration files, Docker images, scripts, and documentation.

Screenshot

Screenshot 2025-10-06 at 10 30 35 PM Screenshot 2025-10-06 at 10 33 07 PM Screenshot 2025-10-06 at 10 33 26 PM Screenshot 2025-10-06 at 10 34 12 PM Screenshot 2025-10-06 at 10 34 56 PM Screenshot 2025-10-06 at 10 36 21 PM Screenshot 2025-10-06 at 10 36 50 PM

Screenshot 2025-10-06 at 10 37 28 PM

-bd9005bea847" /> Screenshot 2025-10-06 at 10 38 26 PM Screenshot 2025-10-06 at 10 39 07 PM Screenshot 2025-10-06 at 10 39 38 PM

Adityashandilya555 and others added 4 commits October 6, 2025 22:24
openwisp#227

Changed VPN_* environment variables to OPENVPN_* to distinguish them
from upcoming WireGuard VPN configurations. This prepares the codebase
for WireGuard support by making OpenVPN-specific variables clearly
identifiable.

Changes:
- VPN_DOMAIN → OPENVPN_DOMAIN
- VPN_NAME → OPENVPN_NAME
- VPN_CLIENT_NAME → OPENVPN_CLIENT_NAME

Updated across configuration files, Docker images, scripts, and documentation.

Fixes openwisp#227
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

This pull request systematically renames environment variables across the codebase from generic VPN_* prefixes to more specific OPENVPN_* prefixes. The three affected variables are: VPN_DOMAINOPENVPN_DOMAIN, VPN_NAMEOPENVPN_NAME, and VPN_CLIENT_NAMEOPENVPN_CLIENT_NAME. The changes span seven files including configuration files (.env, Dockerfile, supervisord.conf), deployment scripts (auto-install.sh), initialization scripts (init_command.sh), documentation (settings.rst), and data initialization code (load_init_data.py). No functional logic, control flow, or behavioral modifications are introduced.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: renaming VPN environment variables to OPENVPN for WireGuard support preparation.
Description check ✅ Passed The description covers the primary objective and lists all three variable renames. However, the checklist shows test cases and documentation updates are incomplete, which may be a concern.
Linked Issues check ✅ Passed All changes align with issue #227's requirement to rename VPN_* to OPENVPN_* across configuration files, Docker images, scripts, and documentation.
Out of Scope Changes check ✅ Passed All changes are within scope: consistent renaming of VPN_* to OPENVPN_* across .env, shell scripts, Python files, Docker configurations, and documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
deploy/auto-install.sh (1)

149-156: Use OPENVPN_DOMAIN in all branches.

The default and “disable” branches still write VPN_DOMAIN, so .env never updates OPENVPN_DOMAIN when the user leaves it blank or disables it. This breaks the rename and keeps stale OpenVPN settings.

🐛 Proposed fix
-		if [[ -z "$vpn_domain" ]]; then
-			set_env "VPN_DOMAIN" "openvpn.${domain}"
+		if [[ -z "$vpn_domain" ]]; then
+			set_env "OPENVPN_DOMAIN" "openvpn.${domain}"
 			set_env CELERY_SERVICE_NETWORK_MODE "service:openvpn"
 		elif [[ "${vpn_domain,,}" == "n" ]]; then
-			set_env "VPN_DOMAIN" ""
+			set_env "OPENVPN_DOMAIN" ""
 			set_env CELERY_SERVICE_NETWORK_MODE ""
 		else
 			set_env "OPENVPN_DOMAIN" "$vpn_domain"
 		fi
images/openwisp_dashboard/load_init_data.py (1)

241-245: Update VPN enablement check to OPENVPN_DOMAIN.

is_vpn_enabled still reads VPN_DOMAIN, so VPN setup will be skipped when only OPENVPN_DOMAIN is set.

🐛 Proposed fix
-    is_vpn_enabled = os.environ.get("VPN_DOMAIN", "") != ""
+    is_vpn_enabled = os.environ.get("OPENVPN_DOMAIN", "") != ""
🤖 Fix all issues with AI agents
In `@docs/user/settings.rst`:
- Around line 58-61: Rename the reST anchor .. _vpn_domain: to ..
_openvpn_domain: in the settings documentation and update the corresponding
cross-reference :ref:`OpenVPN <vpn_domain>` to :ref:`OpenVPN <openvpn_domain>`
so the anchor name matches the environment variable OPENVPN_DOMAIN and the
reference resolves correctly.

In `@images/common/init_command.sh`:
- Line 32: The test using bash-only [[ ]] around OPENVPN_DOMAIN is incompatible
with the /bin/sh shebang; replace the conditional in the init script that checks
OPENVPN_DOMAIN (the line using [[ -z "$OPENVPN_DOMAIN" ]]) with a
POSIX-compatible test using [ -z "$OPENVPN_DOMAIN" ] and ensure proper quoting
and an exit (e.g., exit 1) remains after the test to preserve behavior in the
init_command.sh flow.
🧹 Nitpick comments (1)
docs/user/settings.rst (1)

999-1005: Update description for consistency.

For consistency with the renaming and the description of OPENVPN_NAME (line 994), line 1002 should say "Name of the OpenVPN client template" instead of "Name of the VPN client template".

📝 Suggested fix
-- **Explanation:** Name of the VPN client template that will be visible on
+- **Explanation:** Name of the OpenVPN client template that will be visible on
   the OpenWISP dashboard.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 671eba3 and fa64d1a.

📒 Files selected for processing (7)
  • .env
  • deploy/auto-install.sh
  • docs/user/settings.rst
  • images/common/init_command.sh
  • images/openwisp_base/Dockerfile
  • images/openwisp_dashboard/load_init_data.py
  • images/openwisp_openvpn/supervisord.conf
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-06T11:28:41.789Z
Learnt from: pandafy
Repo: openwisp/docker-openwisp PR: 549
File: docker-compose.yml:171-171
Timestamp: 2026-01-06T11:28:41.789Z
Learning: In docker-openwisp, the OpenVPN container (images/common/init_command.sh) exits silently with exit code 0 when VPN_DOMAIN environment variable is not set. Combined with restart policy "on-failure" in docker-compose.yml, this prevents the container from restarting when VPN is disabled.

Applied to files:

  • images/openwisp_openvpn/supervisord.conf
  • .env
  • images/openwisp_base/Dockerfile
  • deploy/auto-install.sh
  • images/common/init_command.sh
🪛 dotenv-linter (4.0.0)
.env

[warning] 10-10: [UnorderedKey] The OPENVPN_DOMAIN key should go before the SSH_PRIVATE_KEY_PATH key

(UnorderedKey)


[warning] 46-46: [UnorderedKey] The OPENVPN_NAME key should go before the OPENWISP_GEOCODING_CHECK key

(UnorderedKey)


[warning] 47-47: [UnorderedKey] The OPENVPN_CLIENT_NAME key should go before the OPENVPN_DOMAIN key

(UnorderedKey)

🪛 Shellcheck (0.11.0)
images/common/init_command.sh

[warning] 32-32: In POSIX sh, [[ ]] is undefined.

(SC3010)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CI Build
🔇 Additional comments (5)
images/openwisp_openvpn/supervisord.conf (1)

21-21: Rename looks consistent.

Switching to ENV_OPENVPN_NAME aligns with the new env naming.

images/openwisp_base/Dockerfile (1)

154-157: LGTM.

OpenVPN env defaults are renamed consistently.

.env (1)

10-10: LGTM.

Env key renames are consistent with the new OpenVPN naming.

Also applies to: 45-47

docs/user/settings.rst (2)

28-28: LGTM!

The prefix list correctly updated to reflect the OpenVPN-specific naming convention.


991-997: LGTM!

The section correctly renamed and the explanation properly specifies "OpenVPN Server" for clarity.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines 58 to +61
.. _vpn_domain:

``VPN_DOMAIN``
~~~~~~~~~~~~~~
``OPENVPN_DOMAIN``
~~~~~~~~~~~~~~~~~~
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the current state of the file around lines 58-61
sed -n '55,70p' docs/user/settings.rst

Repository: openwisp/docker-openwisp

Length of output: 446


🏁 Script executed:

# Search for cross-references to vpn_domain anchor
rg -n ':ref:`.*vpn_domain.*`' --glob '*.rst'

Repository: openwisp/docker-openwisp

Length of output: 50


🏁 Script executed:

# Search for any references to vpn_domain in the codebase
rg -n 'vpn_domain' --glob '*.rst'

Repository: openwisp/docker-openwisp

Length of output: 163


🏁 Script executed:

# Check if openvpn_domain anchor or references already exist
rg -n 'openvpn_domain' --glob '*.rst'

Repository: openwisp/docker-openwisp

Length of output: 50


🏁 Script executed:

# Examine the context around the vpn_domain reference in quickstart.rst
sed -n '50,65p' docs/user/quickstart.rst

Repository: openwisp/docker-openwisp

Length of output: 897


Update the reStructuredText anchor and cross-reference to match the variable name.

The anchor on line 58 of docs/user/settings.rst uses .. _vpn_domain: while the environment variable is named OPENVPN_DOMAIN. This inconsistency should be resolved by renaming the anchor to .. _openvpn_domain:. Additionally, the cross-reference in docs/user/quickstart.rst:58 that uses :ref:OpenVPN <vpn_domain> must be updated to `:ref:`OpenVPN <openvpn_domain> to maintain the working reference.

Changes required

In docs/user/settings.rst line 58:

-.. _vpn_domain:
+.. _openvpn_domain:

In docs/user/quickstart.rst line 58:

-<vpn_domain>` services.
+<openvpn_domain>` services.
🤖 Prompt for AI Agents
In `@docs/user/settings.rst` around lines 58 - 61, Rename the reST anchor ..
_vpn_domain: to .. _openvpn_domain: in the settings documentation and update the
corresponding cross-reference :ref:`OpenVPN <vpn_domain>` to :ref:`OpenVPN
<openvpn_domain>` so the anchor name matches the environment variable
OPENVPN_DOMAIN and the reference resolves correctly.

fi
elif [ "$MODULE_NAME" = 'openvpn' ]; then
if [[ -z "$VPN_DOMAIN" ]]; then exit; fi
if [[ -z "$OPENVPN_DOMAIN" ]]; then exit; fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Check the shebang and content of the file
head -n 35 images/common/init_command.sh | cat -n

Repository: openwisp/docker-openwisp

Length of output: 1216


Fix POSIX shell incompatibility: use [ ] instead of [[ ]].

Line 32 uses bash-specific [[ ]] test syntax, but the shebang is /bin/sh. This will cause a syntax error in dash (the default /bin/sh in most container environments). Replace with the POSIX-compatible [ -z "$OPENVPN_DOMAIN" ].

Suggested fix
-	if [[ -z "$OPENVPN_DOMAIN" ]]; then exit; fi
+	if [ -z "$OPENVPN_DOMAIN" ]; then exit; fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ -z "$OPENVPN_DOMAIN" ]]; then exit; fi
if [ -z "$OPENVPN_DOMAIN" ]; then exit; fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 32-32: In POSIX sh, [[ ]] is undefined.

(SC3010)

🤖 Prompt for AI Agents
In `@images/common/init_command.sh` at line 32, The test using bash-only [[ ]]
around OPENVPN_DOMAIN is incompatible with the /bin/sh shebang; replace the
conditional in the init script that checks OPENVPN_DOMAIN (the line using [[ -z
"$OPENVPN_DOMAIN" ]]) with a POSIX-compatible test using [ -z "$OPENVPN_DOMAIN"
] and ensure proper quoting and an exit (e.g., exit 1) remains after the test to
preserve behavior in the init_command.sh flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[change!] Update environment variables for OpenVPN

1 participant