Environment Variables
Complete guide to configuring Evolution API Lite through environment variables
Environment Variables
Evolution API Lite is configured through environment variables defined in your .env file. This guide provides a comprehensive overview of all available configuration options, organized by category.
info Copy the .env.example file to .env and modify the values according to your needs. All variables have sensible defaults, but some require configuration for production use.
Server Configuration
Basic Server Settings
| Variable | Type | Default | Description |
|---|---|---|---|
| SERVER_TYPE | http | https | http | Protocol type for the server |
| SERVER_PORT | number | 8080 | Port number where the server will listen |
| SERVER_URL | string | http://localhost:8080 | Full URL where your application is accessible |
CORS Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
| CORS_ORIGIN | string | * | Allowed origins for CORS. Use * for all or comma-separated domains |
| CORS_METHODS | string | GET,POST,PUT,DELETE | Allowed HTTP methods for CORS |
| CORS_CREDENTIALS | boolean | true | Whether to allow credentials in CORS requests |
=== Development Example
SERVER_TYPE=http
SERVER_PORT=8080
SERVER_URL=http://localhost:8080
CORS_ORIGIN=*=== Production Example
SERVER_TYPE=https
SERVER_PORT=443
SERVER_URL=https://api.yourdomain.com
CORS_ORIGIN=https://yourdomain.com,https://app.yourdomain.comLogging Configuration
Log Levels and Output
| Variable | Type | Default | Description |
|---|---|---|---|
| LOG_LEVEL | string | ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK,WEBHOOKS,WEBSOCKET | Comma-separated list of log levels to display |
| LOG_COLOR | boolean | true | Enable colored log output |
| LOG_BAILEYS | string | error | Baileys library log level: fatal, error, warn, info, debug, trace |
Event Emitter Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
| EVENT_EMITTER_MAX_LISTENERS | number | 50 | Maximum number of event listeners per event |
Instance Management
| Variable | Type | Default | Description |
|---|---|---|---|
| DEL_INSTANCE | boolean | number | false | Auto-delete inactive instances. Set to false to disable, or number of minutes for timeout |
warn Setting DEL_INSTANCE to a low value may cause instances to be deleted while users are temporarily offline. Use with caution in production.
Database Configuration
Connection Settings
| Variable | Type | Default | Description |
|---|---|---|---|
| DATABASE_PROVIDER | postgresql | mysql | postgresql | Database provider to use |
| DATABASE_CONNECTION_URI | string | postgresql://user:pass@postgres:5432/evolution?schema=public | Full database connection string |
| DATABASE_CONNECTION_CLIENT_NAME | string | evolution_exchange | Client name for database connection separation |
Data Persistence Options
| Variable | Type | Default | Description |
|---|---|---|---|
| DATABASE_SAVE_DATA_INSTANCE | boolean | true | Save instance data to database |
| DATABASE_SAVE_DATA_NEW_MESSAGE | boolean | true | Save new messages to database |
| DATABASE_SAVE_MESSAGE_UPDATE | boolean | true | Save message updates to database |
| DATABASE_SAVE_DATA_CONTACTS | boolean | true | Save contact information to database |
| DATABASE_SAVE_DATA_CHATS | boolean | true | Save chat information to database |
| DATABASE_SAVE_DATA_LABELS | boolean | true | Save label information to database |
| DATABASE_SAVE_DATA_HISTORIC | boolean | true | Save message history to database |
| DATABASE_SAVE_IS_ON_WHATSAPP | boolean | true | Save WhatsApp presence status |
| DATABASE_SAVE_IS_ON_WHATSAPP_DAYS | number | 7 | Days to keep WhatsApp presence data |
| DATABASE_DELETE_MESSAGE | boolean | true | Enable logical message deletion |
=== PostgreSQL Example
DATABASE_PROVIDER=postgresql
DATABASE_CONNECTION_URI=postgresql://username:password@localhost:5432/evolution_db?schema=public
DATABASE_CONNECTION_CLIENT_NAME=evolution_prod=== MySQL Example
DATABASE_PROVIDER=mysql
DATABASE_CONNECTION_URI=mysql://username:password@localhost:3306/evolution_db
DATABASE_CONNECTION_CLIENT_NAME=evolution_prodCache Configuration
Redis Cache
| Variable | Type | Default | Description |
|---|---|---|---|
| CACHE_REDIS_ENABLED | boolean | true | Enable Redis caching |
| CACHE_REDIS_URI | string | redis://localhost:6379/6 | Redis connection string |
| CACHE_REDIS_TTL | number | 604800 | Cache TTL in seconds (default: 7 days) |
| CACHE_REDIS_PREFIX_KEY | string | evolution | Prefix for Redis keys |
| CACHE_REDIS_SAVE_INSTANCES | boolean | false | Save instance data in Redis instead of database |
Local Cache
| Variable | Type | Default | Description |
|---|---|---|---|
| CACHE_LOCAL_ENABLED | boolean | false | Enable local memory caching |
Event Integration
RabbitMQ Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
| RABBITMQ_ENABLED | boolean | false | Enable RabbitMQ integration |
| RABBITMQ_URI | string | amqp://localhost | RabbitMQ connection string |
| RABBITMQ_EXCHANGE_NAME | string | evolution | Exchange name for RabbitMQ |
| RABBITMQ_GLOBAL_ENABLED | boolean | false | Send events from all instances to same queue |
RabbitMQ Events
All RabbitMQ events are disabled by default. Enable specific events by setting them to true:
- RABBITMQ_EVENTS_APPLICATION_STARTUP
- RABBITMQ_EVENTS_INSTANCE_CREATE
- RABBITMQ_EVENTS_INSTANCE_DELETE
- RABBITMQ_EVENTS_QRCODE_UPDATED
- RABBITMQ_EVENTS_MESSAGES_SET
- RABBITMQ_EVENTS_MESSAGES_UPSERT
- RABBITMQ_EVENTS_MESSAGES_EDITED
- RABBITMQ_EVENTS_MESSAGES_UPDATE
- RABBITMQ_EVENTS_MESSAGES_DELETE
- RABBITMQ_EVENTS_SEND_MESSAGE
- RABBITMQ_EVENTS_CONTACTS_SET
- RABBITMQ_EVENTS_CONTACTS_UPSERT
- RABBITMQ_EVENTS_CONTACTS_UPDATE
- RABBITMQ_EVENTS_PRESENCE_UPDATE
- RABBITMQ_EVENTS_CHATS_SET
- RABBITMQ_EVENTS_CHATS_UPSERT
- RABBITMQ_EVENTS_CHATS_UPDATE
- RABBITMQ_EVENTS_CHATS_DELETE
- RABBITMQ_EVENTS_GROUPS_UPSERT
- RABBITMQ_EVENTS_GROUP_UPDATE
- RABBITMQ_EVENTS_GROUP_PARTICIPANTS_UPDATE
- RABBITMQ_EVENTS_CONNECTION_UPDATE
- RABBITMQ_EVENTS_REMOVE_INSTANCE
- RABBITMQ_EVENTS_LOGOUT_INSTANCE
- RABBITMQ_EVENTS_CALL
- RABBITMQ_EVENTS_TYPEBOT_START
- RABBITMQ_EVENTS_TYPEBOT_CHANGE_STATUS
Amazon SQS Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
| SQS_ENABLED | boolean | false | Enable Amazon SQS integration |
| SQS_ACCESS_KEY_ID | string | - | AWS access key ID |
| SQS_SECRET_ACCESS_KEY | string | - | AWS secret access key |
| SQS_ACCOUNT_ID | string | - | AWS account ID |
| SQS_REGION | string | - | AWS region |
WebSocket Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
| WEBSOCKET_ENABLED | boolean | false | Enable WebSocket support |
| WEBSOCKET_GLOBAL_EVENTS | boolean | false | Send global events via WebSocket |
Pusher Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
| PUSHER_ENABLED | boolean | false | Enable Pusher integration |