Fix MQTT password sync to actually update password.txt

- Add scripts/sync-mqtt-config.ts for standalone sync execution
- Update change-mqtt-admin-password.sh to use tsx to execute sync
- Now properly regenerates password.txt with new hashed password
- Mosquitto config is automatically reloaded after sync

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-01 08:19:25 +00:00
parent c9ce56cbbe
commit b95866f549
2 changed files with 69 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env node
/**
* Standalone script to sync MQTT configuration
* This can be run directly without authentication
*/
import { syncMosquittoConfig } from '../lib/mosquitto-sync';
async function main() {
try {
console.log('Starting MQTT configuration sync...');
const result = await syncMosquittoConfig();
if (result.success) {
console.log('✓ Success:', result.message);
process.exit(0);
} else {
console.error('✗ Failed:', result.message);
process.exit(1);
}
} catch (error) {
console.error('✗ Error:', error instanceof Error ? error.message : String(error));
process.exit(1);
}
}
main();