Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# .env.example - Copy to .env for local development and fill in your values
# Server Port
# PORT=3000

# Logging Level (e.g., 'debug', 'info', 'warn', 'error')
# LOG_LEVEL=info

# Redis Configuration
# REDIS_HOST=127.0.0.1
# REDIS_PORT=6379
# REDIS_PASSWORD=your_redis_password

# API Keys
GROQ_API_KEY=your_groq_api_key
ELEVENLABS_API_KEY=your_elevenlabs_api_key
# Add other API keys for services that require them (e.g. Runway, Claude if they have direct key auth)

# Google Cloud Credentials
# Option 1: Path to service account JSON file (recommended for local dev, CI/CD, some cloud environments)
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/gcp-credentials.json

# Option 2: JSON string content of the service account key (useful for some PaaS environments)
# Ensure the JSON string is correctly escaped if necessary when setting the environment variable.
# GOOGLE_CREDENTIALS_JSON='{"type": "service_account", "project_id": "your-project-id", ...}'

# External Service URLs (override defaults if necessary, though many services are SDK/Playwright based)
# CLAUDE_SERVICE_URL=https://claude.ai
# GEMINI_SERVICE_URL=https://gemini.google.com
# ELEVENLABS_SERVICE_URL=https://elevenlabs.io
# RUNWAY_SERVICE_URL=https://runway.ml
# CANVA_SERVICE_URL=https://canva.com

# Worker and Queue Settings
# WORKER_CONCURRENCY=5
# JOB_DEFAULT_ATTEMPTS=3
# JOB_DEFAULT_BACKOFF_DELAY=5000 # milliseconds

# API Rate Limiting Settings
# API_RATE_LIMIT_WINDOW_MS=900000 # 15 minutes in milliseconds
# API_RATE_LIMIT_MAX=100

# Worker Rate Limiter Settings (for BullMQ worker)
# WORKER_RATE_LIMIT_MAX=10
# WORKER_RATE_LIMIT_DURATION_MS=60000 # milliseconds

# Max characters for text input to AI services (e.g., Groq, Claude)
# AI_INPUT_MAX_CHARS=80000

# Timeouts for External Interactions (in milliseconds)
# DEFAULT_EXTERNAL_API_TIMEOUT_MS=30000
# GROQ_TIMEOUT_MS=30000
# WEB_EXTRACTOR_NAVIGATION_TIMEOUT_MS=60000
# NEW_SERVICE_AI_REQUEST_TIMEOUT_MS=60000
# RUNWAY_VIDEO_GENERATION_TIMEOUT_MS=180000
# RUNWAY_DOWNLOAD_TIMEOUT_MS=60000

# Debugging - Playwright Failure Artifacts
# If true, saves a screenshot and HTML dump to tempDir on Playwright errors in services like youtube.js
# DEBUG_SAVE_PLAYWRIGHT_FAILURE_ARTIFACTS=false

# Temporary Directory
# TEMP_DIR=/tmp/viral_content_temp # Example absolute path for overriding default (project_root/temp)
# If using a relative path, ensure it's handled correctly by the application.
# The default in config/index.js is path.join(__dirname, '..', 'temp') which resolves to <project_root>/temp
79 changes: 79 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// config/index.js
require('dotenv').config(); // Load .env file if present (primarily for development)

module.exports = {
// Server Port
port: parseInt(process.env.PORT, 10) || 3000,

// Logging Level
logLevel: process.env.LOG_LEVEL || 'info',

// Redis Configuration
redis: {
host: process.env.REDIS_HOST || '127.0.0.1',
port: parseInt(process.env.REDIS_PORT, 10) || 6379,
password: process.env.REDIS_PASSWORD || undefined,
},

// API Keys
groqApiKey: process.env.GROQ_API_KEY,
// Add other API keys here as they are identified, e.g., ELEVENLABS_API_KEY
elevenlabsApiKey: process.env.ELEVENLABS_API_KEY,


// Google Cloud Credentials
googleApplicationCredentials: process.env.GOOGLE_APPLICATION_CREDENTIALS, // Path to JSON file
googleCredentialsJson: process.env.GOOGLE_CREDENTIALS_JSON, // JSON string

// External Service URLs (defaults provided)
// These will be used to populate serviceRegistry dynamically
serviceUrls: {
claude: process.env.CLAUDE_SERVICE_URL || 'https://claude.ai',
gemini: process.env.GEMINI_SERVICE_URL || 'https://gemini.google.com',
elevenlabs: process.env.ELEVENLABS_SERVICE_URL || 'https://elevenlabs.io',
runway: process.env.RUNWAY_SERVICE_URL || 'https://runway.ml',
canva: process.env.CANVA_SERVICE_URL || 'https://canva.com',
// YouTube, TikTok, Instagram URLs are more for reference,
// as their services might use Playwright or SDKs directly.
// But can be included for consistency if needed.
youtube: process.env.YOUTUBE_SERVICE_URL || 'https://youtube.com',
tiktok: process.env.TIKTOK_SERVICE_URL || 'https://tiktok.com',
instagram: process.env.INSTAGRAM_SERVICE_URL || 'https://instagram.com',
},

// Worker and Queue Settings
workerConcurrency: parseInt(process.env.WORKER_CONCURRENCY, 10) || 5,
jobDefaultAttempts: parseInt(process.env.JOB_DEFAULT_ATTEMPTS, 10) || 3,
jobDefaultBackoffDelay: parseInt(process.env.JOB_DEFAULT_BACKOFF_DELAY, 10) || 5000, // ms

// API Rate Limiting Settings
apiRateLimitWindowMs: parseInt(process.env.API_RATE_LIMIT_WINDOW_MS, 10) || 15 * 60 * 1000, // 15 minutes
apiRateLimitMax: parseInt(process.env.API_RATE_LIMIT_MAX, 10) || 100,

// Worker Rate Limiter Settings
workerRateLimit: {
max: parseInt(process.env.WORKER_RATE_LIMIT_MAX, 10) || 10, // Max jobs per duration
duration: parseInt(process.env.WORKER_RATE_LIMIT_DURATION_MS, 10) || 60000, // Duration in milliseconds
},

// Add other configurations here as needed
// Example: TEMP_DIR
tempDir: process.env.TEMP_DIR || require('path').join(__dirname, '..', 'temp'), // Relative to project root

// AI Input Settings
aiInputMaxChars: parseInt(process.env.AI_INPUT_MAX_CHARS, 10) || 80000, // Max chars for AI input

// Timeouts for External Interactions (in milliseconds)
timeouts: {
defaultExternalApiMs: parseInt(process.env.DEFAULT_EXTERNAL_API_TIMEOUT_MS, 10) || 30000,
groqMs: parseInt(process.env.GROQ_TIMEOUT_MS, 10) || 30000,
webExtractorNavigationMs: parseInt(process.env.WEB_EXTRACTOR_NAVIGATION_TIMEOUT_MS, 10) || 60000,
newServiceAiRequestMs: parseInt(process.env.NEW_SERVICE_AI_REQUEST_TIMEOUT_MS, 10) || 60000,
runwayVideoGenerationMs: parseInt(process.env.RUNWAY_VIDEO_GENERATION_TIMEOUT_MS, 10) || 180000, // 3 minutes
runwayDownloadMs: parseInt(process.env.RUNWAY_DOWNLOAD_TIMEOUT_MS, 10) || 60000, // 1 minute
},

debug: {
savePlaywrightFailureArtifacts: (process.env.DEBUG_SAVE_PLAYWRIGHT_FAILURE_ARTIFACTS === 'true') || false,
},
};
Loading