Skip to main content

⚙️ Configuration

📖 Overview

Queue Manager uses environment variables for configuration, enabling selective module loading and controlling service behavior.

🔧 Core Environment Variables

Database & Redis (Required)

# MongoDB Connection
MONGO_DB_URL=mongodb://localhost:27017/dashclicks

# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379

Service Configuration

# HTTP Server
PORT=6002 # Queue Manager HTTP port
NODE_ENV=production # Environment mode (development/production)

# Express API Endpoints
QM_HOOKS=true # Enable HTTP API endpoints

🎛️ Module Control Variables

Contact & Account Management

# Contact Processing
QM_CONTACTS=true # Contact import processing
QM_CONTACTS_EXPORT=true # Contact export processing
QM_CONTACTS_EXPORT_CLEANUP=true # Export file cleanup

# Account Management
QM_ACCOUNTS=true # Account import processing
QM_CHECK_ACCOUNT_ACTIVE=true # Account status monitoring

Affiliate Management

# Affiliate Processing
QM_AFFILIATES=true # Affiliate commissions, leaderboard, payout expiration

Subscription Management

# Subscription Lifecycle
QM_SUBSCRIPTION_DOWNGRADE=true # Subscription tier downgrades
QM_SUBSCRIPTION_CANCEL=true # Subscription cancellations
QM_SUBSCRIPTION_ACTIVATE=true # Subscription activations

# Billing & Charges
QM_SUBSCRIPTION_PENDING_SUBACCOUNT_CHARGE=true # Subaccount billing
QM_SUBSCRIPTION_CHARGE_MAINACCOUNT=true # Main account charges
QM_DRAFT_INVOICE=true # Draft invoice processing

Content & Site Management

# InstaReports
QM_INSTAREPORT_BUILD=true # Report generation and building

# InstaSites
QM_INSTASITES_BUILD=true # Site building
QM_INSTASITES_PURGE=true # Site cleanup and purging

# Sites
QM_SITES_BUILD_THUMBNAILS=true # Thumbnail generation
QM_SITE_UPDATE_BUSINESS=true # Business information updates

CRM & Deals

# Deal Processing
QM_DEALS=true # Deal import processing
QM_DEALS_AUTOMATIONS=true # Deal automation workflows

Communication

# Communication Management
QM_COMM_VIOLATION=true # Communication violation detection
QM_COMM_A2P=true # A2P (Application-to-Person) messaging
# Includes: brand, campaign, renewal, number assignment

Conversations & Support

# Support System
QM_SUPPORT_SNOOZE=true # Support ticket snoozing
QM_SUPPORT_MESSAGE_STATUS=true # Message status tracking
QM_SUPPORT_NOTIFICATION=true # Support notifications
QM_SUPPORT_COMMUNICATION_CHECK=true # Communication validation

Reviews & Reputation

# Reputation Management
QM_REPUTATION=true # Review fetching and processing

Domains (Lightning Domains)

# Domain Management
QM_LIGHTNING_DOMAIN_VALIDATION=true # Domain validation
QM_LIGHTNING_DOMAIN_CLEANUP=true # Domain cleanup (PRODUCTION ONLY)
QM_LIGHTNING_DOMAIN_RENEWAL=true # Domain renewal
QM_LIGHTNING_DOMAIN_CANCELLATION=true # Domain cancellation

Funnels

# Funnel Processing
QM_FUNNELS_BACKUP_CLEANUP=true # Funnel backup cleanup
QM_FUNNELS_CLONING=true # Funnel cloning operations
QM_FUNNELS_BUILD_THUMBNAILS=true # Funnel thumbnail generation

OneBalance

# OneBalance System
QM_ONEBALANCE_BALANCE_RELOAD=true # Balance reload processing
QM_ONEBALANCE_BALANCE_RELOAD_STREAM=true # Balance reload via change streams
QM_ONEBALANCE_BALANCE_CHARGE=true # Balance charging
QM_ONEBALANCE_BALANCE_CHARGE_STREAM=true # Balance charge via change streams

Billing Integration

# Billing System
QM_BILLING_NEW_AUTH=true # New billing authentication
QM_BILLING_CONTACTS=true # Billing contact import

Webhooks

# Webhook Processing
QM_WEBHOOK=true # Webhook notifications and delivery

Projects

# Project Management
QM_PROJECTS=true # Project processing

Miscellaneous

# Other Modules
QM_INTERCOM_LEADS=true # Intercom lead processing
QM_VERIFY_STRIPE_DOMAINS=true # Stripe domain verification
QM_TRIGGERS=true # Database triggers
QM_SCHEDULE_UTILIZATION_MONITORING=true # Schedule utilization tracking

🔄 Environment-Controlled Loading

How It Works

Queue Manager's index.js checks each QM_* variable before loading modules:

if (process.env.QM_CONTACTS == 'true') {
const importContacts = require('./crons/contacts/import');
await importContacts.start();
logger.log({
initiator: 'QM/startup/QM_CONTACTS',
message: 'QM_CONTACTS started successfully',
});
}

Benefits

Development Environment:

# Load only contacts module for testing
QM_CONTACTS=true
QM_CONTACTS_EXPORT=true
# All other QM_* variables omitted or set to false

Production Environment:

# Load all required modules
QM_CONTACTS=true
QM_CONTACTS_EXPORT=true
QM_AFFILIATES=true
QM_INSTAREPORT_BUILD=true
# ... enable all production modules

Testing Isolation:

# Test only InstaSites module
QM_INSTASITES_BUILD=true
QM_INSTASITES_PURGE=true

📝 Configuration Best Practices

1. Use .env Files

# Copy sample configuration
cp .env.example .env

# Edit with your values
nano .env

2. Environment-Specific Configs

Development (.env.development):

NODE_ENV=development
MONGO_DB_URL=mongodb://localhost:27017/dashclicks-dev
QM_CONTACTS=true # Only enable modules you're testing

Production (.env.production):

NODE_ENV=production
MONGO_DB_URL=mongodb://prod-cluster:27017/dashclicks
# Enable all production modules
QM_CONTACTS=true
QM_AFFILIATES=true
QM_INSTAREPORT_BUILD=true
# ... all required modules

3. Security Considerations

Never commit sensitive values:

# .gitignore
.env
.env.local
.env.production

Use environment variable injection:

  • Docker secrets
  • Kubernetes ConfigMaps/Secrets
  • Cloud provider secret managers (AWS Secrets Manager, etc.)

4. Validation

Queue Manager logs successful module initialization:

[QM/startup/QM_CONTACTS] QM_CONTACTS started successfully
[QM/startup/QM_AFFILIATES] QM_AFFILIATES started successfully

Check logs to verify your configuration loaded correctly.

🚨 Critical Configuration Notes

1. Domain Cleanup Warning

# ONLY enable in production with production database
QM_LIGHTNING_DOMAIN_CLEANUP=true

⚠️ WARNING: This module will cleanup ALL domains not found in connected database. Never enable with production credentials in non-production environments.

The code explicitly checks:

if (process.env.NODE_ENV == 'production') {
// Domain cleanup only runs in production
} else {
logger.warn({
message: 'QM_LIGHTNING_DOMAIN_CLEANUP can only run in production',
});
}

2. Change Stream Modules

Change stream modules (*_STREAM) require MongoDB replica set:

QM_ONEBALANCE_BALANCE_RELOAD_STREAM=true
QM_ONEBALANCE_BALANCE_CHARGE_STREAM=true

Ensure MongoDB is configured as a replica set before enabling.

3. Redis Requirement

All queue modules require Redis connection:

REDIS_HOST=localhost
REDIS_PORT=6379

Without Redis, Queue Manager will fail to start.


Configuration Version: 1.0.0
Last Updated: 2025-10-10

💬

Documentation Assistant

Ask me anything about the docs

Hi! I'm your documentation assistant. Ask me anything about the docs!

I can help you with:
- Code examples
- Configuration details
- Troubleshooting
- Best practices

Try asking: How do I configure the API?
09:31 AM