diff --git a/change-mqtt-admin-password.sh b/change-mqtt-admin-password.sh index 9584e54..1757e5a 100755 --- a/change-mqtt-admin-password.sh +++ b/change-mqtt-admin-password.sh @@ -66,52 +66,11 @@ sleep 5 echo -e "${GREEN}✓ App should be ready${NC}" echo -# Step 4: Trigger sync via internal Node.js script -echo -e "${YELLOW}Step 4: Triggering MQTT configuration sync...${NC}" - -# Create a temporary Node.js script to trigger sync -cat > /tmp/trigger-mqtt-sync.js << 'EOF' -// Trigger MQTT Sync from inside the container -async function triggerSync() { - try { - // Import the sync function - const { syncMosquittoConfig } = require('./lib/mosquitto-sync'); - - console.log('Triggering Mosquitto sync...'); - const result = await syncMosquittoConfig(); - - if (result.success) { - console.log('✓ Sync successful'); - console.log('Message:', result.message); - process.exit(0); - } else { - console.error('✗ Sync failed'); - console.error('Message:', result.message); - process.exit(1); - } - } catch (error) { - console.error('✗ Sync error:', error.message); - process.exit(1); - } -} - -triggerSync(); -EOF - -# Copy script into container and execute -docker cp /tmp/trigger-mqtt-sync.js location-tracker:/app/trigger-mqtt-sync.js - -# Execute the sync script inside the container -if docker exec location-tracker node trigger-mqtt-sync.js; then - echo -e "${GREEN}✓ MQTT configuration synced successfully${NC}" -else - echo -e "${RED}✗ Sync failed, but password is updated in .env${NC}" - echo -e "${YELLOW}You can manually trigger sync from the Admin Panel${NC}" -fi - -# Cleanup -docker exec location-tracker rm -f trigger-mqtt-sync.js -rm -f /tmp/trigger-mqtt-sync.js +# Step 4: Manual sync instruction (automatic sync removed due to authentication requirement) +echo -e "${YELLOW}Step 4: MQTT configuration sync${NC}" +echo -e "${YELLOW}Note: Automatic sync requires admin authentication.${NC}" +echo -e "${YELLOW}Please log into the Admin Panel and click 'Sync MQTT Config' to apply the new password.${NC}" +echo -e "${YELLOW}Alternatively, restart Mosquitto: docker-compose restart mosquitto${NC}" echo echo -e "${GREEN}========================================${NC}"