Environment Configuration
Overview
This section documents the specific configuration for each environment, including environment variables, connection parameters, and service-specific settings.
Available Environments
Development Environment
- Purpose: Local development and testing
- Database: Local development database
- APIs: Mock services for testing
- Logging: Debug level with console output
Staging Environment
- Purpose: Pre-production testing and validation
- Database: Staging database with real data
- APIs: Staging APIs for integration testing
- Logging: Info level with file output
Production Environment
- Purpose: Live production environment
- Database: Production database with real data
- APIs: Production APIs with full monitoring
- Logging: Error level with centralized logging
Environment Variables
Development Environment
bash
# Server Configuration
NODE_ENV=development
PORT=5173
HOST=localhost
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=procesar_dev
DB_USER=dev_user
DB_PASSWORD=dev_password
# External APIs
API_BASE_URL=http://localhost:3000/api
RENAPO_URL=http://172.21.66.90/ServiciosInternos/ServicioRenapo?wsdl
# Logging Configuration
LOG_LEVEL=debug
LOG_TO_CONSOLE=trueStaging Environment
bash
# Server Configuration
NODE_ENV=staging
PORT=3000
HOST=0.0.0.0
# Database Configuration
DB_HOST=staging-db.procesar.com
DB_PORT=5432
DB_NAME=procesar_staging
DB_USER=staging_user
DB_PASSWORD=${STAGING_DB_PASSWORD}
# External APIs
API_BASE_URL=https://staging-api.procesar.com
RENAPO_URL=http://172.21.62.1/ServiciosInternos/ServicioRenapo?wsdl
# Logging Configuration
LOG_LEVEL=info
LOG_TO_CONSOLE=false
LOG_TO_FILE=trueProduction Environment
bash
# Server Configuration
NODE_ENV=production
PORT=3000
HOST=0.0.0.0
# Database Configuration
DB_HOST=prod-db.procesar.com
DB_PORT=5432
DB_NAME=procesar_prod
DB_USER=prod_user
DB_PASSWORD=${PROD_DB_PASSWORD}
# External APIs
API_BASE_URL=https://api.procesar.com
RENAPO_URL=http://172.21.62.1/ServiciosInternos/ServicioRenapo?wsdl
# Logging Configuration
LOG_LEVEL=error
LOG_TO_CONSOLE=false
LOG_TO_FILE=trueService Configuration
RENAPO - CURP Consultation
Development
javascript
const renapoConfig = {
development: {
url: 'http://172.21.66.90/ServiciosInternos/ServicioRenapo?wsdl',
timeout: 30000,
retries: 3,
logLevel: 'debug'
}
}Staging
javascript
const renapoConfig = {
staging: {
url: 'http://172.21.62.1/ServiciosInternos/ServicioRenapo?wsdl',
timeout: 20000,
retries: 2,
logLevel: 'info'
}
}Production
javascript
const renapoConfig = {
production: {
url: 'http://172.21.62.1/ServiciosInternos/ServicioRenapo?wsdl',
timeout: 15000,
retries: 1,
logLevel: 'error'
}
}Portal Servicios Banamex
Development
javascript
const banamexConfig = {
development: {
baseUrl: 'http://172.21.62.1/portalserviciosint',
timeout: 30000,
retries: 3,
mockData: true
}
}Staging
javascript
const banamexConfig = {
staging: {
baseUrl: 'http://172.21.62.1/portalserviciosint',
timeout: 20000,
retries: 2,
mockData: false
}
}Production
javascript
const banamexConfig = {
staging: {
baseUrl: 'http://172.21.62.1/portalserviciosint',
timeout: 20000,
retries: 2,
mockData: false
},
production: {
baseUrl: 'http://172.21.62.1/portalserviciosint',
timeout: 15000,
retries: 1,
mockData: false
}
}Secrets Management
Environment Variables
Never store sensitive information directly in code:
bash
# ❌ Incorrect - Hardcoded secrets
DB_PASSWORD=super_secret_password
API_KEY=api_secret_key_12345
# ✅ Correct - Using environment variables
DB_PASSWORD=${PROD_DB_PASSWORD}
API_KEY=${PROD_API_KEY}Secrets Management Services
- AWS Secrets Manager: For production environments
- Azure Key Vault: For enterprise applications
- HashiCorp Vault: For on-premises deployments
Configuration Validation
Pre-Deployment Checklist
- [ ] Environment variables configured
- [ ] Database connections tested
- [ ] External API endpoints accessible
- [ ] Logging configuration verified
- [ ] Security settings applied
Validation Scripts
bash
#!/bin/bash
# Check required environment variables
if [ -z "$DB_HOST" ]; then
echo "❌ DB_HOST not configured"
exit 1
fi
# Test database connection
psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "SELECT 1"
if [ $? -ne 0 ]; then
echo "❌ Database connection failed"
exit 1
fi
echo "✅ Configuration validated"Best Practices
For Developers
- Use Environment-Specific Configuration: Never use production settings in development
- Document All Variables: Maintain a complete list of all environment variables
- Validate Configuration: Implement validation scripts for all environments
- Secure Secrets: Use proper secrets management for all environments
For Operations Teams
- Environment Isolation: Keep development, staging, and production completely separate
- Configuration Management: Use infrastructure as code for environment configuration
- Access Control: Implement proper access controls for configuration changes
- Monitoring: Set up comprehensive monitoring for all environments
INFORMACIÓN
Note: This documentation is updated automatically as part of the CI/CD pipeline. For the most current information, always check the configuration management system.