Skip to content

Environment Variables

Complete reference for BrowserStack Code Quality environment variables and configuration options.

Core & Security Variables

Variable NameDescriptionExample/Usage
ACCEPT_EULAAccept End-User License Agreement. Set to "Y" to acknowledge agreement to terms and conditions.ACCEPT_EULA=Y
gamma_ui_public_hostPublicly accessible URL for the application. Used for external integrations and user access.gamma_ui_public_host=http://192.168.2.91:3000
ssl_keyFile path to SSL private key for encrypted connections.ssl_key=/opt/gamma/certs/server.key
ssl_certFile path to SSL certificate for establishing secure connections.ssl_cert=/opt/gamma/certs/server.crt
ssl_portPort number for SSL/HTTPS communication.ssl_port=443
ssl_passphrasePassphrase required to unlock encrypted SSL private key.ssl_passphrase=secure_password
ROOT_CERTS_PATHContainer directory path for root certificates and trusted CA certificates.ROOT_CERTS_PATH=/opt/gamma/certs

Proxy Settings Variables

Variable NameDescriptionExample/Usage
EMB_PROXY_HOSTHostname or IP address of corporate proxy server.EMB_PROXY_HOST=proxy.company.com
EMB_PROXY_PORTPort number used by the proxy server for connection.EMB_PROXY_PORT=3128
EMB_PROXY_USERNAMEUsername for proxy authentication (if required by proxy).EMB_PROXY_USERNAME=proxyuser
EMB_PROXY_PASSWORDPassword for proxy authentication (if required by proxy).EMB_PROXY_PASSWORD=proxypass
HTTP_PROXYComplete HTTP proxy URL including authentication credentials.HTTP_PROXY=http://user:pass@proxy.company.com:8080
HTTPS_PROXYComplete HTTPS proxy URL including authentication credentials.HTTPS_PROXY=https://user:pass@proxy.company.com:8080
NO_PROXYComma-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 NameDescriptionExample/Usage
EMB_SCM_TRUST_SERVER_CERTTrust self-signed certificates in Source Control Management systems. Set to true for non-verified certificates.EMB_SCM_TRUST_SERVER_CERT=true
EMB_USE_NATIVE_PYPARSEREnable native Python parser for improved accuracy in Python code analysis.EMB_USE_NATIVE_PYPARSER=true
ANALYSER_XMXMaximum heap memory allocation for analysis engine. Scale based on codebase size.ANALYSER_XMX=-Xmx15g
RISK_XMXMaximum heap memory allocation for risk calculation engine.RISK_XMX=-Xmx1024m
EMB_ANALYSER_THREADSNumber of threads allocated for analysis engine during code scanning.EMB_ANALYSER_THREADS=8
EMB_PARSER_THREADSNumber of threads allocated for code parsing operations.EMB_PARSER_THREADS=4
EMB_CHECKER_THREADSNumber of threads allocated for running code quality checkers.EMB_CHECKER_THREADS=4

Database Configuration Variables

Variable NameDescriptionExample/Usage
PGHOSTPostgreSQL database server hostname or IP address.PGHOST=db
PGPORTPostgreSQL database server port number.PGPORT=5432
PGUSERUsername for PostgreSQL database connection.PGUSER=postgres
PGPASSWORDPassword for PostgreSQL database authentication.PGPASSWORD=secure_db_password
GAMMA_DATABASEName of the primary application database.GAMMA_DATABASE=gamma
ANALYTICS_DATABASEName of the analytics and reporting database.ANALYTICS_DATABASE=corona

Advanced Configuration Variables

Variable NameDescriptionExample/Usage
EMB_REMOTE_SCANEnable remote scanning mode for distributed analysis.EMB_REMOTE_SCAN=true
EMB_REMOTE_SCAN_STRICTEnable strict mode for remote scanning (improves C++ analysis accuracy).EMB_REMOTE_SCAN_STRICT=true
EMB_SCAN_TIMEOUTMaximum time (in minutes) allowed for code analysis operations.EMB_SCAN_TIMEOUT=120
EMB_MAX_FILE_SIZEMaximum file size (in MB) that will be processed during analysis.EMB_MAX_FILE_SIZE=50
EMB_UI_TIMEOUTWeb interface session timeout (in minutes).EMB_UI_TIMEOUT=60
EMB_LOG_LEVELApplication logging level (ERROR, WARN, INFO, DEBUG).EMB_LOG_LEVEL=INFO
EMB_TEMP_DIRCustom temporary directory path for analysis operations.EMB_TEMP_DIR=/opt/gamma_data/temp

CI/CD Integration Variables

Variable NameDescriptionExample/Usage
EMB_CI_MODEEnable CI/CD integration mode with optimized settings.EMB_CI_MODE=true
EMB_FAIL_ON_GATEFail CI pipeline when quality gate conditions are not met.EMB_FAIL_ON_GATE=true
EMB_WEBHOOK_URLWebhook URL for posting analysis completion notifications.EMB_WEBHOOK_URL=https://hooks.slack.com/...
EMB_API_TOKENAPI token for programmatic access and automation.EMB_API_TOKEN=abc123def456...
EMB_BRANCH_PATTERNRegular 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.1

Memory Sizing Guidelines

Codebase Size (LOC)ANALYSER_XMXEMB_ANALYSER_THREADSContainer Memory
< 1 Million-Xmx6g412 GB
1-10 Million-Xmx15g832 GB
> 10 Million-Xmx30g1264 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 .env files 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 HeapSize

Common 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.com

SSL 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 md5

Configuration 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 -d

Secure 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_password

Performance 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.com

Environment 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.txt