Skip to main content
CyborgDB Service uses environment variables to configure various aspects of the service, such as database connections, API keys, SSL settings, and performance tuning. This allows for flexible configuration without hardcoding values in your codebase. Below are the key environment variables you can set for the CyborgDB service:

Required Environment Variables

These environment variables must be set for the service to run:
VariableDescriptionRequiredExample
CYBORGDB_API_KEYYour CyborgDB API key for authenticationcyborg_abc123...
CYBORGDB_DB_TYPEDatabase backend typepostgres or redis
CYBORGDB_CONNECTION_STRINGDatabase connection detailsSee Connection Formats
The service will not start without these three required variables.

Optional Environment Variables

VariableDescriptionDefaultExample
PORTPort number for the service80003000
APP_NAMEApplication name for loggingCyborgDB ServiceMy CyborgDB Instance
CYBORGDB_SERVICE_LOG_LEVELLogging level for the serviceinfodebug
VariableDescriptionDefaultExample
REQUIRE_API_KEYWhether to require API key authenticationtruefalse
SSL_CERT_PATHPath to SSL certificate file for HTTPSNone/etc/ssl/certs/server.crt
SSL_KEY_PATHPath to SSL private key file for HTTPSNone/etc/ssl/private/server.key
When both SSL_CERT_PATH and SSL_KEY_PATH are provided and the files exist, the service automatically enables HTTPS.
These variables provide granular control over database connections. If not set, they fall back to the main database configuration:
VariableDescriptionDefaultExample
INDEX_LOCATIONDatabase type for index storageCYBORGDB_DB_TYPEpostgres
CONFIG_LOCATIONDatabase type for config storageCYBORGDB_DB_TYPEredis
ITEMS_LOCATIONDatabase type for items storageCYBORGDB_DB_TYPEpostgres
INDEX_CONNECTION_STRINGConnection string for index storageCYBORGDB_CONNECTION_STRINGSee connection formats
CONFIG_CONNECTION_STRINGConnection string for config storageCYBORGDB_CONNECTION_STRINGSee connection formats
ITEMS_CONNECTION_STRINGConnection string for items storageCYBORGDB_CONNECTION_STRINGSee connection formats
These variables allow you to customize the table/collection names used by the service:
VariableDescriptionDefaultExample
INDEX_TABLE_NAMETable name for indexesindexcyborgdb_indexes
CONFIG_TABLE_NAMETable name for configurationsconfigcyborgdb_configs
ITEMS_TABLE_NAMETable name for itemsitemscyborgdb_items
These variables allow you to optimize performance based on your hardware and workload:
VariableDescriptionDefaultExample
CPU_THREADSNumber of CPU threads to use0 (auto-detect)4
GPU_ACCELERATEEnable GPU acceleration if availablefalsetrue
WORKERSNumber of worker processes for handling requests0 (auto-calculate)8
These variables control system-level settings:
VariableDescriptionDefaultExample
KMP_DUPLICATE_LIB_OKAllow duplicate OpenMP librariesTRUEFALSE
PYTHONUNBUFFEREDDisable Python output buffering10

Connection Formats

Use the standard PostgreSQL connection string format:
CYBORGDB_CONNECTION_STRING="host=localhost port=5432 dbname=cyborgdb user=cyborgdb password=your_password"
Parameters:
  • host - Database server hostname
  • port - Database server port (default: 5432)
  • dbname - Database name
  • user - Database username
  • password - Database password
Use a comma-separated format for Redis connections:
CYBORGDB_CONNECTION_STRING="host=localhost,port=6379,db=0"
Parameters:
  • host - Redis server hostname
  • port - Redis server port (default: 6379)
  • db - Redis database number (default: 0)
  • password - Redis password (optional)
Redis URI format (redis:// or rediss://) is not supported. Use the comma-separated format shown above.

Configuration Examples

export CYBORGDB_API_KEY="cyborg_your_api_key_here"
export CYBORGDB_DB_TYPE="postgres"
export CYBORGDB_CONNECTION_STRING="host=localhost port=5432 dbname=cyborgdb user=cyborgdb password=secure_password"
export CYBORGDB_API_KEY="cyborg_your_api_key_here"
export CYBORGDB_DB_TYPE="postgres"
export CYBORGDB_CONNECTION_STRING="host=db.example.com port=5432 dbname=cyborgdb user=cyborgdb password=secure_password"
export PORT="8443"
export SSL_CERT_PATH="/etc/ssl/certs/cyborgdb.crt"
export SSL_KEY_PATH="/etc/ssl/private/cyborgdb.key"
export WORKERS="16"
For advanced use cases where you want to use different databases for different components:

Docker Configuration

When using Docker, you can pass environment variables using the -e flag:
docker run -p 8000:8000 \
  -e CYBORGDB_API_KEY="cyborg_your_api_key_here" \
  -e CYBORGDB_DB_TYPE="postgres" \
  -e CYBORGDB_CONNECTION_STRING="host=host.docker.internal port=5432 dbname=cyborgdb user=cyborgdb password=secure_password" \
  cyborginc/cyborgdb-service:latest
Or use an environment file:
docker run -p 8000:8000 --env-file .env cyborginc/cyborgdb-service:latest

Environment Variable Priority

Environment variables are loaded in the following order (later sources override earlier ones):
  1. Default values - Set in the application code
  2. .env file - Local environment file in the working directory
  3. System environment variables - Set via export or container environment
  4. Command line arguments - Passed directly to the application

Validation and Error Handling

The CyborgDB service performs automatic validation of environment variables on startup:
  • Missing required variables - Service will exit with error messages
  • Invalid database types - Only postgres and redis are supported
  • Connection testing - Database connections are tested on startup
  • SSL certificate validation - Certificate files are checked for existence
If validation fails, the service will display helpful error messages with examples of correct configuration.

Troubleshooting

  • Ensure CYBORGDB_API_KEY is set
  • Check for typos in the variable name
  • Verify the API key format starts with cyborg_
  • Verify database is running and accessible
  • Check connection string format
  • Test database connectivity manually
  • Ensure firewall allows connections
  • Verify certificate files exist at specified paths
  • Check file permissions (service must be able to read certificates)
  • Ensure certificate and key files match
  • Use absolute paths for certificate locations