- Remove hardcoded database credentials from all scripts - Remove hardcoded Legacy API tokens from backend scripts - Remove hardcoded MQTT credentials from mqtt-test.js - Update backend/.env.example with DB_HOST, DB_USER, DB_PASSWORD, DB_NAME - Update backend/.env.example with LEGACY_API_TOKEN and MQTT credentials - Add dotenv config to all scripts requiring credentials - Create comprehensive documentation: - scripts/README.md - Root scripts usage - backend/scripts/README.md - Backend scripts documentation - MQTT_TESTING.md - MQTT testing guide - SECURITY_CREDENTIALS_CLEANUP.md - Security changes summary All scripts now read credentials from backend/.env instead of hardcoded values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Backend Scripts
This directory contains database utility scripts for development and testing.
Environment Variables
These scripts require environment variables to be set. Create a .env file in the backend/ directory with the following variables:
# Database Configuration
DB_HOST=your-database-host
DB_PORT=5432
DB_NAME=your-database-name
DB_USER=your-database-user
DB_PASSWORD=your-database-password
# Legacy API Configuration
LEGACY_API_USERNAME=your-username
LEGACY_API_TOKEN=your-jwt-token
Available Scripts
create-test-user.js
Creates a test user with a known OTP code for development/testing.
Usage:
cd backend
node scripts/create-test-user.js
This will create a user with:
- Email:
test@test.com - OTP:
123456
inspect-db.js
Inspects the database schema to understand table structure and columns.
Usage:
cd backend
node scripts/inspect-db.js
check-legacy-deployments.js
Checks synchronization between WellNuo database and Legacy API deployments.
Usage:
cd backend
node check-legacy-deployments.js
fix-legacy-deployments.js
Creates missing legacy deployments for beneficiaries.
Usage:
cd backend
node fix-legacy-deployments.js
Security
⚠️ IMPORTANT: Never commit files containing actual credentials to the repository. Always use environment variables for sensitive information.
- Database credentials should be stored in
backend/.env(this file is git-ignored) - See
backend/.env.examplefor the required format