Skip to main content

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

VariableDescriptionDefault Value
DATABASE_PROVIDER *Defines the type of database used (PostgreSQL, MySQL, MongoDB).'postgresql'
DATABASE_URL *Database connection URL.(Not provided)
SERVER_PORTPort for the application server.'8083'
LOG_LEVELSets the log levels to be displayed.'ERROR,WARN,DEBUG,INFO,LOG,DARK'
LOG_COLOREnables or disables colors in logs.'true'
DEL_INSTANCETime 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_URLURL for the global webhook, which notifies all events of all businesses and instances.'url'
GLOBAL_WEBHOOK_ENABLEDEnables or disables the global webhook.'false'
DATABASE_SYNC_MESSAGESControls synchronization of loaded messages with messages in the database. Saves only messages not existing in the database.'true'
DATABASE_SAVE_DATA_NEW_MESSAGEDetermines whether to save new messages to the database.'true'
DATABASE_SAVE_MESSAGE_UPDATEEnables saving updates to messages in the database.'true'
DATABASE_SAVE_DATA_CONTACTSControls saving of contact data to the database.'true'
DATABASE_SAVE_DATA_CHATSDetermines whether to save chat data to the database.'true'
DATABASE_SAVE_LOGSEnables saving logs to the database.'true'
REDIS_SESSION_ENABLEDEnables or disables Redis sessions for working with instance sessions.'false'
REDIS_SESSION_URIURI for the Redis session, used when Redis sessions are enabled.'redis://127.0.0.1/2'
REDIS_SESSION_PREFIX_KEYPrefix 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_CLIENTClient name for the phone session.'CodeChat_V2'
CONFIG_SESSION_PHONE_NAMEName for the phone session.'Edge'
QRCODE_LIMITLimit for QR code display.'10'
AUTHENTICATION_ADMIN_TOKENGlobal token for handling all businesses and their instances.'t8OOEeISKzpmc3jjcMqBWYSaJsafdefer'
AUTHENTICATION_JWT_EXPIRIN_INJWT expiration time in seconds. '0' indicates it never expires.0 (never expires)
AUTHENTICATION_JWT_SECRETSecret key for encrypting and decrypting the JWT token.'L0YWtjb2w554WFqPG'
SESSION_SECRETSecret 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_KEYLicense 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.