Add VPN configuration update to setup scripts

This commit is contained in:
Roger Gonzalez 2024-12-26 09:43:20 -03:00
parent 17085d4def
commit a83479d307
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 24 additions and 0 deletions

View File

@ -381,6 +381,18 @@ update_configuration_files() {
-e "s|vpn_enabled|$setup_vpn|g" "$env_file" || \ -e "s|vpn_enabled|$setup_vpn|g" "$env_file" || \
log_error "Failed to update .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 # Update docker-compose.yaml
log_info "Updating docker-compose configuration..." log_info "Updating docker-compose configuration..."
sed -i "s|<media_service>|$media_service|g" "$filename" || \ sed -i "s|<media_service>|$media_service|g" "$filename" || \

View File

@ -307,6 +307,18 @@ update_configuration_files() {
-e "s|vpn_enabled|$setup_vpn|g" "$env_file" || \ -e "s|vpn_enabled|$setup_vpn|g" "$env_file" || \
log_error "Failed to update .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 # Update docker-compose.yaml
log_info "Updating docker-compose configuration..." log_info "Updating docker-compose configuration..."
sed -i "s|<media_service>|$media_service|g" "$filename" || \ sed -i "s|<media_service>|$media_service|g" "$filename" || \