Appearance
Environment Variables
Complete reference for BrowserStack Code Quality environment variables and configuration options.
Core & Security Variables
| Variable Name | Description | Example/Usage |
|---|---|---|
ACCEPT_EULA | Accept End-User License Agreement. Set to "Y" to acknowledge agreement to terms and conditions. | ACCEPT_EULA=Y |
gamma_ui_public_host | Publicly accessible URL for the application. Used for external integrations and user access. | gamma_ui_public_host=http://192.168.2.91:3000 |
ssl_key | File path to SSL private key for encrypted connections. | ssl_key=/opt/gamma/certs/server.key |
ssl_cert | File path to SSL certificate for establishing secure connections. | ssl_cert=/opt/gamma/certs/server.crt |
ssl_port | Port number for SSL/HTTPS communication. | ssl_port=443 |
ssl_passphrase | Passphrase required to unlock encrypted SSL private key. | ssl_passphrase=secure_password |
ROOT_CERTS_PATH | Container directory path for root certificates and trusted CA certificates. | ROOT_CERTS_PATH=/opt/gamma/certs |
Proxy Settings Variables
| Variable Name | Description | Example/Usage |
|---|---|---|
EMB_PROXY_HOST | Hostname or IP address of corporate proxy server. | EMB_PROXY_HOST=proxy.company.com |
EMB_PROXY_PORT | Port number used by the proxy server for connection. | EMB_PROXY_PORT=3128 |
EMB_PROXY_USERNAME | Username for proxy authentication (if required by proxy). | EMB_PROXY_USERNAME=proxyuser |
EMB_PROXY_PASSWORD | Password for proxy authentication (if required by proxy). | EMB_PROXY_PASSWORD=proxypass |
HTTP_PROXY | Complete HTTP proxy URL including authentication credentials. | HTTP_PROXY=http://user:pass@proxy.company.com:8080 |
HTTPS_PROXY | Complete HTTPS proxy URL including authentication credentials. | HTTPS_PROXY=https://user:pass@proxy.company.com:8080 |
NO_PROXY | Comma-separated list of hosts that should bypass proxy. Use pipe separator for multiple exclusions. | NO_PROXY=localhost,127.0.0.1,.company.com |
Analysis & Threading Variables
| Variable Name | Description | Example/Usage |
|---|---|---|
EMB_SCM_TRUST_SERVER_CERT | Trust self-signed certificates in Source Control Management systems. Set to true for non-verified certificates. | EMB_SCM_TRUST_SERVER_CERT=true |
EMB_USE_NATIVE_PYPARSER | Enable native Python parser for improved accuracy in Python code analysis. | EMB_USE_NATIVE_PYPARSER=true |
ANALYSER_XMX | Maximum heap memory allocation for analysis engine. Scale based on codebase size. | ANALYSER_XMX=-Xmx15g |
RISK_XMX | Maximum heap memory allocation for risk calculation engine. | RISK_XMX=-Xmx1024m |
EMB_ANALYSER_THREADS | Number of threads allocated for analysis engine during code scanning. | EMB_ANALYSER_THREADS=8 |
EMB_PARSER_THREADS | Number of threads allocated for code parsing operations. | EMB_PARSER_THREADS=4 |
EMB_CHECKER_THREADS | Number of threads allocated for running code quality checkers. | EMB_CHECKER_THREADS=4 |
Database Configuration Variables
| Variable Name | Description | Example/Usage |
|---|---|---|
PGHOST | PostgreSQL database server hostname or IP address. | PGHOST=db |
PGPORT | PostgreSQL database server port number. | PGPORT=5432 |
PGUSER | Username for PostgreSQL database connection. | PGUSER=postgres |
PGPASSWORD | Password for PostgreSQL database authentication. | PGPASSWORD=secure_db_password |
GAMMA_DATABASE | Name of the primary application database. | GAMMA_DATABASE=gamma |
ANALYTICS_DATABASE | Name of the analytics and reporting database. | ANALYTICS_DATABASE=corona |
Advanced Configuration Variables
| Variable Name | Description | Example/Usage |
|---|---|---|
EMB_REMOTE_SCAN | Enable remote scanning mode for distributed analysis. | EMB_REMOTE_SCAN=true |
EMB_REMOTE_SCAN_STRICT | Enable strict mode for remote scanning (improves C++ analysis accuracy). | EMB_REMOTE_SCAN_STRICT=true |
EMB_SCAN_TIMEOUT | Maximum time (in minutes) allowed for code analysis operations. | EMB_SCAN_TIMEOUT=120 |
EMB_MAX_FILE_SIZE | Maximum file size (in MB) that will be processed during analysis. | EMB_MAX_FILE_SIZE=50 |
EMB_UI_TIMEOUT | Web interface session timeout (in minutes). | EMB_UI_TIMEOUT=60 |
EMB_LOG_LEVEL | Application logging level (ERROR, WARN, INFO, DEBUG). | EMB_LOG_LEVEL=INFO |
EMB_TEMP_DIR | Custom temporary directory path for analysis operations. | EMB_TEMP_DIR=/opt/gamma_data/temp |
CI/CD Integration Variables
| Variable Name | Description | Example/Usage |
|---|---|---|
EMB_CI_MODE | Enable CI/CD integration mode with optimized settings. | EMB_CI_MODE=true |
EMB_FAIL_ON_GATE | Fail CI pipeline when quality gate conditions are not met. | EMB_FAIL_ON_GATE=true |
EMB_WEBHOOK_URL | Webhook URL for posting analysis completion notifications. | EMB_WEBHOOK_URL=https://hooks.slack.com/... |
EMB_API_TOKEN | API token for programmatic access and automation. | EMB_API_TOKEN=abc123def456... |
EMB_BRANCH_PATTERN | Regular expression pattern for branch-specific analysis. | `EMB_BRANCH_PATTERN=^(main |
Docker Compose Configuration
Example docker-compose.yml environment section with commonly used variables:
yaml
environment:
# Core Settings
- ACCEPT_EULA=Y
- gamma_ui_public_host=http://localhost:3000
# Database Configuration
- PGHOST=db
- PGPORT=5432
- PGUSER=postgres
- PGPASSWORD=postgres
- GAMMA_DATABASE=gamma
- ANALYTICS_DATABASE=corona
# Performance Settings
- ANALYSER_XMX=-Xmx6072m
- RISK_XMX=-Xmx1024m
- EMB_ANALYSER_THREADS=4
- EMB_PARSER_THREADS=2
# Optional: Proxy Settings
- HTTP_PROXY=http://proxy.company.com:8080
- HTTPS_PROXY=http://proxy.company.com:8080
- NO_PROXY=localhost,127.0.0.1Memory Sizing Guidelines
| Codebase Size (LOC) | ANALYSER_XMX | EMB_ANALYSER_THREADS | Container Memory |
|---|---|---|---|
| < 1 Million | -Xmx6g | 4 | 12 GB |
| 1-10 Million | -Xmx15g | 8 | 32 GB |
| > 10 Million | -Xmx30g | 12 | 64 GB |
NOTE
ANALYSER_XMX should not exceed 70% of total container memory allocation.
Security Considerations
- Sensitive Values: Store passwords and certificates securely using Docker secrets or external secret management
- Environment Files: Use
.envfiles for local development, avoid committing to version control - Access Control: Restrict access to environment variable configuration in production environments
- Certificate Paths: Ensure SSL certificate files are properly protected with appropriate file permissions
Troubleshooting
Environment Variable Validation
Check Current Configuration:
bash
# Display all environment variables in container
docker exec BrowserStackCodeQuality env | sort
# Check specific variables
docker exec BrowserStackCodeQuality env | grep -E "(ANALYSER_XMX|PGHOST|gamma_ui_public_host)"
# Validate memory settings
docker exec BrowserStackCodeQuality sh -c 'echo "Container Memory: $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes | numfmt --to=iec)"'
docker exec BrowserStackCodeQuality java -XX:+PrintFlagsFinal -version | grep HeapSizeCommon Configuration Issues
Memory Configuration Problems:
bash
# Check if ANALYSER_XMX exceeds container memory
CONTAINER_MEMORY=$(docker inspect BrowserStackCodeQuality | jq '.[0].HostConfig.Memory')
echo "Container Memory: $CONTAINER_MEMORY bytes"
# Verify Java can allocate specified heap
docker exec BrowserStackCodeQuality java -XX:+PrintFlagsFinal -Xmx15g -version >/dev/null 2>&1 && echo "Memory allocation OK" || echo "Memory allocation failed"Database Connection Issues:
bash
# Test database connectivity with current settings
docker exec BrowserStackCodeQuality psql -h "$PGHOST" -U "$PGUSER" -d "$GAMMA_DATABASE" -c "SELECT version();"
# Check database environment variables
docker exec BrowserStackCodeQuality env | grep ^PG
# Validate database exists
docker exec BrowserStackCodeQuality psql -h "$PGHOST" -U "$PGUSER" -l | grep -E "(gamma|corona)"Proxy Connection Failures:
bash
# Test proxy connectivity
docker exec BrowserStackCodeQuality curl -x "$HTTP_PROXY" -I http://www.google.com
# Check proxy environment variables
docker exec BrowserStackCodeQuality env | grep -i proxy
# Test connectivity without proxy
docker exec BrowserStackCodeQuality curl --noproxy "*" -I http://www.google.comSSL Certificate Issues:
bash
# Verify certificate files exist
docker exec BrowserStackCodeQuality ls -la "$ssl_cert" "$ssl_key"
# Check certificate validity
docker exec BrowserStackCodeQuality openssl x509 -in "$ssl_cert" -text -noout | grep -A 2 Validity
# Test certificate and key pairing
docker exec BrowserStackCodeQuality openssl x509 -noout -modulus -in "$ssl_cert" | openssl md5
docker exec BrowserStackCodeQuality openssl rsa -noout -modulus -in "$ssl_key" | openssl md5Configuration File Management
Environment File Best Practices:
bash
# Create .env file for local development
cat > .env << EOF
# Core Settings
ACCEPT_EULA=Y
gamma_ui_public_host=http://localhost:3000
# Database Configuration
PGHOST=localhost
PGPORT=5432
PGUSER=postgres
PGPASSWORD=secure_password
GAMMA_DATABASE=gamma
ANALYTICS_DATABASE=corona
# Performance Settings
ANALYSER_XMX=-Xmx6g
RISK_XMX=-Xmx1024m
EMB_ANALYSER_THREADS=4
EOF
# Use with docker-compose
docker-compose --env-file .env up -dSecure Variable Management:
bash
# Use Docker secrets for sensitive data
echo "secure_db_password" | docker secret create postgres_password -
# Reference in compose file:
# secrets:
# - postgres_password
# environment:
# - PGPASSWORD_FILE=/run/secrets/postgres_passwordPerformance Monitoring by Environment Variables
bash
# Monitor thread utilization
docker exec BrowserStackCodeQuality ps aux | grep -E "(analyzer|parser|checker)" | wc -l
# Check memory usage against configured limits
docker exec BrowserStackCodeQuality sh -c '
HEAP_USED=$(jstat -gc $(pgrep java) | tail -1 | awk "{print \$3+\$4+\$6+\$8}")
HEAP_MAX=$(java -XX:+PrintFlagsFinal -version 2>&1 | grep MaxHeapSize | awk "{print \$4}")
echo "Heap Usage: ${HEAP_USED}MB / ${HEAP_MAX}MB"
'
# Validate proxy performance impact
docker exec BrowserStackCodeQuality time curl -x "$HTTP_PROXY" -o /dev/null -s http://www.google.com
docker exec BrowserStackCodeQuality time curl --noproxy "*" -o /dev/null -s http://www.google.comEnvironment Variable Migration
Upgrading Configuration:
bash
# Backup current environment variables
docker inspect BrowserStackCodeQuality | jq '.[0].Config.Env' > current_env.json
# Compare with new requirements
echo "Missing variables in current configuration:"
docker run --rm browserstack/code-quality:1.9.36.0 env | sort > new_env_vars.txt
docker exec BrowserStackCodeQuality env | sort > current_env_vars.txt
comm -23 new_env_vars.txt current_env_vars.txtRelated Documentation
- Memory Settings – Performance optimization guidelines
- Docker Deployment – Container setup and configuration
- Updates Guide – Version management procedures
