Environment Variables
CodeChat API Environment Settings
Setting up the environment is a critical step in the process of installing and operating CodeChat API, an advanced integration platform with WhatsApp. These configurations involve defining environment variables that allow you to customize and optimize application execution according to the specific needs of the hosting environment and project requirements.
Environment variables cover many aspects of the system, including database connections, server configurations, process management, security, and integrations. The correct configuration of these variables is essential to ensure that the application works efficiently, securely and stably. Below is a detailed table with each of the environment variables and their respective descriptions, providing a clear view of the purpose and importance of each setting in the context of the CodeChat API.
Here is a detailed table describing each environment variable required for CodeChat API application configuration:
Parameters marked with * are required.
OBS: Rename the .env.dev file to .env.cp .env.dev .env
Enhanced Table Format for Environment Variables Documentation
Variable | Description | Default Value |
---|---|---|
DATABASE_PROVIDER * | Defines the type of database used (PostgreSQL, MySQL, MongoDB). | 'postgresql' |
DATABASE_URL * | Database connection URL. | (Not provided) |
SERVER_PORT | Port for the application server. | '8083' |
LOG_LEVEL | Sets the log levels to be displayed. | 'ERROR,WARN,DEBUG,INFO,LOG,DARK' |
LOG_COLOR | Enables or disables colors in logs. | 'true' |
DEL_INSTANCE | Time for deleting the instance from memory in case of no connection. If set to a time value, specifies the idle time before deletion. If 'false', there is no expiration. | 'false' |
GLOBAL_WEBHOOK_URL | URL for the global webhook, which notifies all events of all businesses and instances. | 'url' |
GLOBAL_WEBHOOK_ENABLED | Enables or disables the global webhook. | 'false' |
DATABASE_SYNC_MESSAGES | Controls synchronization of loaded messages with messages in the database. Saves only messages not existing in the database. | 'true' |
DATABASE_SAVE_DATA_NEW_MESSAGE | Determines whether to save new messages to the database. | 'true' |
DATABASE_SAVE_MESSAGE_UPDATE | Enables saving updates to messages in the database. | 'true' |
DATABASE_SAVE_DATA_CONTACTS | Controls saving of contact data to the database. | 'true' |
DATABASE_SAVE_DATA_CHATS | Determines whether to save chat data to the database. | 'true' |
DATABASE_SAVE_LOGS | Enables saving logs to the database. | 'true' |
REDIS_SESSION_ENABLED | Enables or disables Redis sessions for working with instance sessions. | 'false' |
REDIS_SESSION_URI | URI for the Redis session, used when Redis sessions are enabled. | 'redis://127.0.0.1/2' |
REDIS_SESSION_PREFIX_KEY | Prefix key for Redis sessions. | 'codechat_v2' |
REDIS_STORE_URI * | URI for the Redis store, used for working with internal data to optimize instance processes. | 'redis://127.0.0.1/3' |
CONFIG_SESSION_PHONE_CLIENT | Client name for the phone session. | 'CodeChat_V2' |
CONFIG_SESSION_PHONE_NAME | Name for the phone session. | 'Edge' |
QRCODE_LIMIT | Limit for QR code display. | '10' |
AUTHENTICATION_ADMIN_TOKEN | Global token for handling all businesses and their instances. | 't8OOEeISKzpmc3jjcMqBWYSaJsafdefer' |
AUTHENTICATION_JWT_EXPIRIN_IN | JWT expiration time in seconds. '0' indicates it never expires. | 0 (never expires) |
AUTHENTICATION_JWT_SECRET | Secret key for encrypting and decrypting the JWT token. | 'L0YWtjb2w554WFqPG' |
SESSION_SECRET | Secret for HTTP sessions, particularly useful for MVC applications. | 'R#2M!sP9eCcL&oAa' |
BACKEND_URL * | The domain or public IP of the application. This is a required variable. | (None provided) |
CONNECTOR_LICENSE_KEY | License key for the connector. | 'default_temporary_license' |
These environment variables are essential for configuring and customizing the operation of the application according to the specific needs of the environment in which it will be executed.