#!/bin/bash # Script to update push notifications to internal-only configuration echo "================================" echo "Push Notification Internal Setup" echo "================================" # Configuration summary cat << EOF This script will update your LittleShop configuration to: 1. Use mailto: VAPID subject instead of public URL 2. Keep all push notifications internal (VPN only) 3. Remove dependency on thebankofdebbie.giize.com Current Changes: - Docker Compose: WebPush__VapidSubject = mailto:admin@littleshop.local - Appsettings: Subject = mailto:admin@littleshop.local EOF read -p "Do you want to proceed? (y/n): " -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Aborted." exit 1 fi echo "Step 1: Updating environment variable documentation..." cat > /tmp/env-example << 'EOF' # Example environment variables for production deployment # JWT Configuration JWT_SECRET_KEY=your-secure-jwt-key-here # SilverPay Configuration SILVERPAY_BASE_URL=http://your-silverpay-url:8001 SILVERPAY_API_KEY=your-silverpay-api-key SILVERPAY_WEBHOOK_SECRET=your-webhook-secret SILVERPAY_WEBHOOK_URL=http://your-domain/api/orders/payments/webhook # WebPush Configuration (Internal Only) WEBPUSH_VAPID_PUBLIC_KEY=your-vapid-public-key WEBPUSH_VAPID_PRIVATE_KEY=your-vapid-private-key WEBPUSH_SUBJECT=mailto:admin@yourdomain.com # Royal Mail (Optional) ROYALMAIL_CLIENT_ID= ROYALMAIL_CLIENT_SECRET= ROYALMAIL_SENDER_ADDRESS=Your Business Address ROYALMAIL_SENDER_CITY=Your City ROYALMAIL_SENDER_POSTCODE=Your Postcode EOF echo "Step 2: Checking current Docker status..." if command -v docker &> /dev/null; then if docker ps | grep -q littleshop; then echo "⚠️ LittleShop container is running" read -p "Do you want to restart it with new configuration? (y/n): " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Restarting container..." docker-compose down docker-compose up -d echo "✅ Container restarted with new configuration" else echo "⚠️ Remember to restart manually: docker-compose restart" fi else echo "✅ LittleShop container not running" fi else echo "Docker not found on this system" fi echo "" echo "Step 3: NPM Configuration" echo "=========================" echo "" echo "IMPORTANT: You should now remove thebankofdebbie.giize.com from NPM:" echo "1. Log into NPM at http://10.13.13.1:81" echo "2. Find and delete the proxy host for thebankofdebbie.giize.com" echo "3. All push notifications will work through admin.dark.side (VPN only)" echo "" echo "Step 4: Testing Push Notifications" echo "===================================" echo "" echo "To test push notifications after the changes:" echo "1. Access admin panel via VPN: https://admin.dark.side" echo "2. Clear browser cache/cookies if you had notifications enabled before" echo "3. Re-enable notifications when prompted" echo "4. Use the 'Test Notification' button to verify" echo "" echo "✅ Configuration Summary" echo "========================" echo "- VAPID Subject: mailto:admin@littleshop.local" echo "- Access URL: https://admin.dark.side (VPN only)" echo "- Public domain: Not needed anymore" echo "- Security: All push traffic stays internal" echo "" echo "Script complete!" echo "" echo "Note: If you encounter any issues, the push notification system will" echo "continue to work as long as:" echo "1. Users access via the VPN (admin.dark.side)" echo "2. The VAPID keys remain unchanged" echo "3. The browser can reach FCM servers for notification delivery"