Market Data Service is a high-performance financial data API that provides comprehensive Symbol prices of different markets through both RESTful endpoints and real-time WebSocket connections.
Complete guide for configuring the Market Data Service environment variables and settings.
| Variable | Description | Example |
|---|---|---|
DB_PASSWORD |
PostgreSQL database password | your_secure_password |
JWT_SECRET |
JWT secret key for authentication | generated_secret_key |
DOMAIN_NAME |
Domain name for SSL certificates | market-price.insightbull.io |
SSL_EMAIL |
Email for Let's Encrypt notifications | admin@insightbull.io |
| Variable | Description | Default |
|---|---|---|
DB_USER |
PostgreSQL database user | postgres |
DB_NAME |
Database name | financial_data |
NODE_ENV |
Environment mode | production |
PORT |
API port (internal) | 3000 |
CORS_ORIGIN |
Allowed CORS origins | * |
LOG_LEVEL |
Logging level | info |
SSL_STAGING |
Use Let's Encrypt staging server | 0 |
Create a .env file in the project root:
# Database Configuration
DB_USER=postgres
DB_PASSWORD=your_secure_password_here
DB_NAME=financial_data
# Application Configuration
NODE_ENV=production
PORT=3000
CORS_ORIGIN=https://market-price.insightbull.io
JWT_SECRET=your_secure_jwt_secret_here
LOG_LEVEL=info
# SSL Certificate Configuration
DOMAIN_NAME=market-price.insightbull.io
SSL_EMAIL=admin@insightbull.io
For local development:
# Database Configuration
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=financial_data
# Application Configuration
NODE_ENV=development
PORT=3000
CORS_ORIGIN=*
JWT_SECRET=dev_secret_key
LOG_LEVEL=debug
# SSL not needed for local development
Generate a secure JWT secret:
# Using OpenSSL
openssl rand -base64 32
# Using Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
Then update in .env:
JWT_SECRET=<generated_secret>
Use a strong, unique password for production:
The production domain is: market-price.insightbull.io
Important:
.env as DOMAIN_NAME=market-price.insightbull.iohttps://market-price.insightbull.ioFor local development, use: market-data.local
See LOCAL_DEV_SETUP.md for local domain setup.
SSL certificates are automatically managed via Docker containers. No manual configuration needed.
Required variables:
DOMAIN_NAME - Your domain nameSSL_EMAIL - Email for Let's Encrypt notificationsFor testing (staging server):
SSL_STAGING=1
See DEPLOYMENT.md for SSL certificate setup instructions.
CORS_ORIGIN=https://market-price.insightbull.io
CORS_ORIGIN=*
For multiple allowed origins, use comma-separated values (check your CORS middleware implementation).
debug - Detailed debug information (development)info - General information (production)warn - Warning messageserror - Error messages onlyLOG_LEVEL=info
LOG_LEVEL=debug
When using Docker, database connection is automatic:
DB_HOST=db (service name in docker-compose)DB_PORT=5432 (internal port).envFor non-Docker setups:
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=financial_data
# Verify .env file exists
ls -la .env
# Check environment variables (in Docker)
docker-compose exec api env | grep -E 'DB_|JWT_|DOMAIN_|SSL_'
# Test database connection
docker-compose exec db psql -U postgres -d financial_data -c "SELECT 1;"
# Test API health
curl http://localhost/health
.env file - Already in .gitignore* in productionProblem: Variables not being read
Solution:
# Check .env file exists
ls -la .env
# Verify Docker is reading .env
docker-compose config | grep -A 5 environment
Problem: SSL certificate not working
Solution:
DOMAIN_NAME matches your actual domainProblem: Can't connect to database
Solution:
DB_PASSWORD is correctdocker-compose ps dbdocker-compose exec db pg_isready -U postgres