From a83479d3077d859a3dca2f93f2e2c425954d3155 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Thu, 26 Dec 2024 09:43:20 -0300 Subject: [PATCH] Add VPN configuration update to setup scripts --- docs.org | 12 ++++++++++++ install.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/docs.org b/docs.org index 97f8cf8..c813126 100644 --- a/docs.org +++ b/docs.org @@ -381,6 +381,18 @@ update_configuration_files() { -e "s|vpn_enabled|$setup_vpn|g" "$env_file" || \ log_error "Failed to update .env file" + # Update VPN configuration in .env file +if [ "${setup_vpn,,}" == "y" ]; then +sed -i -e "s|^VPN_ENABLED=.*|VPN_ENABLED=y|" \ + -e "s|^VPN_SERVICE=.*|VPN_SERVICE=$vpn_service|" \ + -e "s|^VPN_USER=.*|VPN_USER=$vpn_user|" \ + -e "s|^VPN_PASSWORD=.*|VPN_PASSWORD=$vpn_password|" "$env_file" || \ + log_error "Failed to update VPN configuration in .env" +else +sed -i -e "s|^VPN_ENABLED=.*|VPN_ENABLED=n|" "$env_file" || \ + log_error "Failed to update VPN configuration in .env" +fi + # Update docker-compose.yaml log_info "Updating docker-compose configuration..." sed -i "s||$media_service|g" "$filename" || \ diff --git a/install.sh b/install.sh index d4eb42c..116014d 100644 --- a/install.sh +++ b/install.sh @@ -307,6 +307,18 @@ update_configuration_files() { -e "s|vpn_enabled|$setup_vpn|g" "$env_file" || \ log_error "Failed to update .env file" + # Update VPN configuration in .env file +if [ "${setup_vpn,,}" == "y" ]; then +sed -i -e "s|^VPN_ENABLED=.*|VPN_ENABLED=y|" \ + -e "s|^VPN_SERVICE=.*|VPN_SERVICE=$vpn_service|" \ + -e "s|^VPN_USER=.*|VPN_USER=$vpn_user|" \ + -e "s|^VPN_PASSWORD=.*|VPN_PASSWORD=$vpn_password|" "$env_file" || \ + log_error "Failed to update VPN configuration in .env" +else +sed -i -e "s|^VPN_ENABLED=.*|VPN_ENABLED=n|" "$env_file" || \ + log_error "Failed to update VPN configuration in .env" +fi + # Update docker-compose.yaml log_info "Updating docker-compose configuration..." sed -i "s||$media_service|g" "$filename" || \