- Implemented a comprehensive health check utility to monitor system dependencies including NocoDB, SMTP, Represent API, disk space, and memory usage. - Created a logger utility using Winston for structured logging with daily rotation and various log levels. - Developed a metrics utility using Prometheus client to track application performance metrics such as email sends, HTTP requests, and user activity. - Added a backup script for automated backups of NocoDB data, uploaded files, and environment configurations with optional S3 support. - Introduced a toggle script to switch between development (MailHog) and production (ProtonMail) SMTP configurations.
140 lines
4.2 KiB
Bash
140 lines
4.2 KiB
Bash
# BNKops Influence Campaign Tool - Environment Configuration Example
|
|
# Copy this file to .env and update with your actual values
|
|
|
|
# NocoDB Configuration
|
|
# Your NocoDB instance URL and API configuration
|
|
NOCODB_URL=https://your-nocodb-instance.com
|
|
NOCODB_API_URL=https://your-nocodb-instance.com/api/v1
|
|
NOCODB_API_TOKEN=your_nocodb_api_token_here
|
|
NOCODB_PROJECT_ID=your_project_id
|
|
|
|
# SMTP Configuration
|
|
# Configure your email service provider settings. See below for development mode smtp
|
|
# SMTP_HOST=smtp.your-provider.com
|
|
# SMTP_PORT=587
|
|
# SMTP_SECURE=false
|
|
# SMTP_USER=your-email@domain.com
|
|
# SMTP_PASS=your_email_password_or_app_password
|
|
# SMTP_FROM_EMAIL=your-sender@domain.com
|
|
# SMTP_FROM_NAME="Your Campaign Name"
|
|
|
|
# Admin Configuration
|
|
# Set a strong password for admin access
|
|
ADMIN_PASSWORD=change_this_to_a_strong_password
|
|
|
|
# Represent API Configuration
|
|
# Canadian electoral data API (usually no changes needed)
|
|
REPRESENT_API_BASE=https://represent.opennorth.ca
|
|
REPRESENT_API_RATE_LIMIT=60
|
|
|
|
# App Configuration
|
|
# Your application URL and basic settings
|
|
APP_NAME="BNKops Influence"
|
|
APP_URL=http://localhost:3333
|
|
BASE_URL=http://localhost:3333
|
|
PORT=3333
|
|
SESSION_SECRET=generate_a_long_random_string_here_at_least_64_characters_long
|
|
NODE_ENV=development
|
|
|
|
# Email Testing Configuration
|
|
# IMPORTANT: Set to true for development/testing, false for production
|
|
EMAIL_TEST_MODE=true
|
|
TEST_EMAIL_RECIPIENT=your-test-email@domain.com
|
|
|
|
# Email Verification Configuration
|
|
# For email-to-campaign conversion feature
|
|
EMAIL_VERIFICATION_ENABLED=true
|
|
EMAIL_VERIFICATION_EXPIRY=24
|
|
|
|
# NocoDB Table IDs
|
|
# These will be auto-generated when you run build-nocodb.sh
|
|
# DO NOT modify these manually - they are set by the setup script
|
|
NOCODB_TABLE_REPRESENTATIVES=
|
|
NOCODB_TABLE_EMAILS=
|
|
NOCODB_TABLE_POSTAL_CODES=
|
|
NOCODB_TABLE_CAMPAIGN_EMAILS=
|
|
NOCODB_TABLE_CAMPAIGNS=
|
|
NOCODB_TABLE_USERS=
|
|
NOCODB_TABLE_CALLS=
|
|
NOCODB_TABLE_REPRESENTATIVE_RESPONSES=
|
|
NOCODB_TABLE_RESPONSE_UPVOTES=
|
|
NOCODB_TABLE_EMAIL_VERIFICATIONS=
|
|
|
|
# Redis Configuration (for email queue and caching)
|
|
# Uses centralized Redis from root docker-compose.yml
|
|
REDIS_HOST=redis-changemaker
|
|
REDIS_PORT=6379
|
|
REDIS_PASSWORD=
|
|
REDIS_DB=0
|
|
|
|
# Backup Configuration
|
|
BACKUP_RETENTION_DAYS=30
|
|
BACKUP_ENCRYPTION_KEY=generate_a_strong_encryption_key_here
|
|
BACKUP_BASE_DIR=/path/to/backups
|
|
USE_S3_BACKUP=false
|
|
S3_BACKUP_BUCKET=
|
|
S3_BACKUP_PREFIX=influence-backups
|
|
REMOVE_LOCAL_AFTER_S3=false
|
|
|
|
# Monitoring Configuration (optional)
|
|
GRAFANA_ADMIN_PASSWORD=change_this_for_production
|
|
|
|
# Optional: Development Mode Settings
|
|
# Uncomment and modify these for local development with centralized MailHog
|
|
# MailHog runs from root docker-compose.yml as a shared service
|
|
SMTP_HOST=mailhog-changemaker
|
|
SMTP_PORT=1025
|
|
SMTP_SECURE=false
|
|
SMTP_USER=
|
|
SMTP_PASS=
|
|
SMTP_FROM_EMAIL=dev@albertainfluence.local
|
|
SMTP_FROM_NAME="BNKops Influence Campaign (DEV)"
|
|
|
|
# Security Notes:
|
|
# - Keep your .env file secure and never commit it to version control
|
|
# - Use strong, unique passwords for ADMIN_PASSWORD
|
|
# - Generate a secure random string for SESSION_SECRET (64+ characters)
|
|
# - For production, ensure EMAIL_TEST_MODE=false and HTTPS=true
|
|
# - Use app passwords or API keys for SMTP_PASS, not your main email password
|
|
# - Rotate all secrets regularly (every 90 days recommended)
|
|
|
|
# Generate Secure Secrets:
|
|
# SESSION_SECRET: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
|
|
# BACKUP_ENCRYPTION_KEY: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
|
|
|
# Common SMTP Provider Examples:
|
|
#
|
|
# Gmail:
|
|
# SMTP_HOST=smtp.gmail.com
|
|
# SMTP_PORT=587
|
|
# SMTP_SECURE=false
|
|
# SMTP_USER=your-email@gmail.com
|
|
# SMTP_PASS=your_app_password
|
|
#
|
|
# ProtonMail:
|
|
# SMTP_HOST=smtp.protonmail.ch
|
|
# SMTP_PORT=587
|
|
# SMTP_SECURE=false
|
|
# SMTP_USER=your-email@protonmail.com
|
|
# SMTP_PASS=your_app_password
|
|
#
|
|
# Outlook/Hotmail:
|
|
# SMTP_HOST=smtp-mail.outlook.com
|
|
# SMTP_PORT=587
|
|
# SMTP_SECURE=false
|
|
# SMTP_USER=your-email@outlook.com
|
|
# SMTP_PASS=your_app_password
|
|
#
|
|
# SendGrid:
|
|
# SMTP_HOST=smtp.sendgrid.net
|
|
# SMTP_PORT=587
|
|
# SMTP_SECURE=false
|
|
# SMTP_USER=apikey
|
|
# SMTP_PASS=your_sendgrid_api_key
|
|
#
|
|
# AWS SES:
|
|
# SMTP_HOST=email-smtp.us-east-1.amazonaws.com
|
|
# SMTP_PORT=587
|
|
# SMTP_SECURE=false
|
|
# SMTP_USER=your_aws_smtp_username
|
|
# SMTP_PASS=your_aws_smtp_password |