This script loads environment variables from a .env file. It checks multiple possible paths for the .env file and loads the first one that exists. If no .env file is found, it logs an error message with the attempted paths. The loaded configuration is then exported for use in other parts of the application. * @property {Object} CONFIG - An object containing the loaded configuration.
PropertiesName | Type | Description |
---|---|---|
CONFIG.host | string | The host value from the .env file. |
CONFIG.token | string | The token value from the .env file. |
CONFIG.tokenSlave | string | The tokenSlave value from the .env file. |
Example
import CONFIG from './config.js';
console.log(CONFIG.host); // Outputs the host value from the .env file