7.0 KiB
7.0 KiB
Environment Variables Configuration
📋 Required Environment Variables
Copy these to your .env file and update the values:
# ============================================
# Database Configuration
# ============================================
DB_HOST=localhost
DB_PORT=3306
DB_NAME=centralized_reporting
DB_USER=root
DB_PASSWORD=your_password
# ============================================
# JWT Configuration
# ============================================
JWT_SECRET=your_jwt_secret_key_here_change_in_production
JWT_EXPIRES_IN=1h
# ============================================
# Redis Configuration (for session storage)
# ============================================
REDIS_HOST=localhost
REDIS_PORT=6379
# ============================================
# Server Configuration
# ============================================
PORT=3000
NODE_ENV=development
API_PREFIX=/api/v1
# ============================================
# n8n Webhook Configuration
# ============================================
# Base URL of your n8n instance (without trailing slash)
N8N_WEBHOOK_URL=https://workflows.tech4bizsolutions.com
# Webhook path (the part between base URL and webhook ID)
# Default: 'webhook' for http://localhost:5678/webhook/ID
# Custom: 'webhook-test' for https://workflows.tech4bizsolutions.com/webhook-test/ID
N8N_WEBHOOK_PATH=webhook-test
# Your n8n workflow webhook ID
N8N_WEBHOOK_ID=04e677f5-ec57-4772-bf12-96f2610d4b9c
# ============================================
# OAuth - Zoho
# ============================================
ZOHO_CLIENT_ID=your_zoho_client_id
ZOHO_CLIENT_SECRET=your_zoho_client_secret
ZOHO_REDIRECT_URI=centralizedreportingsystem://oauth/callback
# ============================================
# OAuth - Salesforce
# ============================================
SALESFORCE_CLIENT_ID=your_salesforce_client_id
SALESFORCE_CLIENT_SECRET=your_salesforce_client_secret
SALESFORCE_REDIRECT_URI=centralizedreportingsystem://oauth/callback
# For production: https://login.salesforce.com
# For sandbox: https://test.salesforce.com
SALESFORCE_INSTANCE_URL=https://login.salesforce.com
# ============================================
# OAuth - HubSpot
# ============================================
HUBSPOT_CLIENT_ID=your_hubspot_client_id
HUBSPOT_CLIENT_SECRET=your_hubspot_client_secret
HUBSPOT_REDIRECT_URI=centralizedreportingsystem://oauth/callback
# ============================================
# Encryption
# ============================================
ENCRYPTION_KEY=changeme
🔧 n8n Webhook URL Configuration
Your Configuration
Based on your webhook URL: https://workflows.tech4bizsolutions.com/webhook-test/04e677f5-ec57-4772-bf12-96f2610d4b9c
N8N_WEBHOOK_URL=https://workflows.tech4bizsolutions.com
N8N_WEBHOOK_PATH=webhook-test
N8N_WEBHOOK_ID=04e677f5-ec57-4772-bf12-96f2610d4b9c
This will construct the webhook URL as:
https://workflows.tech4bizsolutions.com/webhook-test/04e677f5-ec57-4772-bf12-96f2610d4b9c
Default Configuration (Local n8n)
For local n8n instance:
N8N_WEBHOOK_URL=http://localhost:5678
N8N_WEBHOOK_PATH=webhook
N8N_WEBHOOK_ID=04e677f5-ec57-4772-bf12-96f2610d4b9c
This will construct:
http://localhost:5678/webhook/04e677f5-ec57-4772-bf12-96f2610d4b9c
📝 Variable Descriptions
n8n Webhook Variables
| Variable | Description | Example | Required |
|---|---|---|---|
N8N_WEBHOOK_URL |
Base URL of n8n instance (no trailing slash) | https://workflows.tech4bizsolutions.com |
Yes |
N8N_WEBHOOK_PATH |
Path segment between base URL and webhook ID | webhook-test |
Yes |
N8N_WEBHOOK_ID |
Unique webhook identifier from n8n workflow | 04e677f5-ec57-4772-bf12-96f2610d4b9c |
Yes |
How It Works
The client constructs the full webhook URL like this:
const url = `${baseUrl}/${webhookPath}/${webhookId}`;
// Result: https://workflows.tech4bizsolutions.com/webhook-test/04e677f5-ec57-4772-bf12-96f2610d4b9c
🔐 Security Notes
Production Environment
For production, make sure to:
-
Use Strong JWT Secret
JWT_SECRET=use_a_long_random_string_here_min_32_chars -
Use Strong Encryption Key
ENCRYPTION_KEY=use_a_different_long_random_string -
Use HTTPS for n8n
N8N_WEBHOOK_URL=https://workflows.tech4bizsolutions.com -
Secure Database Credentials
- Use strong passwords
- Limit database user permissions
- Use environment-specific credentials
Development Environment
For development, you can use simpler values:
JWT_SECRET=dev_secret_key
ENCRYPTION_KEY=changeme
N8N_WEBHOOK_URL=http://localhost:5678
🧪 Testing Configuration
To verify your n8n webhook configuration:
# Test the webhook URL
curl -X POST https://workflows.tech4bizsolutions.com/webhook-test/04e677f5-ec57-4772-bf12-96f2610d4b9c \
-H "Content-Type: application/json" \
-d '{
"body": {
"provider": "zoho",
"service": "crm",
"module": "leads",
"acces_token": "test_token"
},
"query": {
"per_page": 100,
"page": 1
}
}'
Expected Response:
- Should return data from n8n workflow
- Check n8n workflow execution logs
📦 Required Services
1. MySQL Database
# Check if MySQL is running
mysql -u root -p
# Create database
CREATE DATABASE centralized_reporting;
2. Redis (Optional but recommended)
# Check if Redis is running
redis-cli ping
# Should return: PONG
3. n8n Workflow
- n8n instance must be running at the configured URL
- Workflow must be activated
- Webhook must be accessible
🔄 Multiple Environments
Development (.env.development)
N8N_WEBHOOK_URL=http://localhost:5678
N8N_WEBHOOK_PATH=webhook
NODE_ENV=development
Staging (.env.staging)
N8N_WEBHOOK_URL=https://workflows-staging.tech4bizsolutions.com
N8N_WEBHOOK_PATH=webhook-test
NODE_ENV=staging
Production (.env.production)
N8N_WEBHOOK_URL=https://workflows.tech4bizsolutions.com
N8N_WEBHOOK_PATH=webhook-test
NODE_ENV=production
✅ Quick Setup Checklist
- Copy
.env.exampleto.env - Update database credentials
- Set strong JWT secret
- Set strong encryption key
- Configure n8n webhook URL
- Add OAuth credentials (Zoho, Salesforce)
- Verify Redis connection
- Test n8n webhook accessibility
- Run database migrations
- Start the server
- Test API endpoints
🆘 Troubleshooting
"Cannot connect to n8n webhook"
- Verify
N8N_WEBHOOK_URLis correct - Check if n8n instance is running
- Verify
N8N_WEBHOOK_PATHmatches your n8n configuration - Test webhook URL manually with curl
"Database connection failed"
- Check
DB_HOST,DB_PORT,DB_NAME - Verify database user credentials
- Ensure MySQL service is running
"Redis connection failed"
- Check
REDIS_HOSTandREDIS_PORT - Verify Redis service is running
- Redis is optional for basic functionality
Last Updated: October 9, 2025
Version: 1.0.0