Overview
vLife DGO uses environment variables to configure database connections, server settings, and security keys. All configuration is managed through thesrc/config.js file, which loads variables from a .env file using the dotenv package.
Required Variables
The following environment variables should be configured for production deployments:MySQL database host address. Use
localhost for local development or the database server IP/hostname for production.MySQL database port. The standard MySQL port is 3306.
Database username with appropriate privileges for the vLife DGO database.
Database user password. Must be set in production for security.
Name of the MySQL database for vLife DGO. This variable is used for multiple connection pools.
Port number where the Express server will listen for HTTP requests.
Encryption key used for data protection. Must be changed in production to a secure, random value.
Configuration File
The configuration is centralized insrc/config.js:
Setup Instructions
Secure the .env file
Ensure
.env is listed in your .gitignore file to prevent committing sensitive credentials:Environment-Specific Configuration
Development Environment
Production Environment
Default Values
All environment variables have default fallback values defined insrc/config.js. These defaults are suitable for local development but must be changed for production:
| Variable | Default Value | Production Required |
|---|---|---|
PORT | 4001 | Optional |
DB_HOST | localhost | Yes |
DB_PORT | 3306 | Optional |
DB_USER | root | Yes |
DB_PASS | "" (empty) | Yes |
DB_DATABASE | vlifedgo_db | Optional |
SUPER_KEY | key_cecc | Yes |
The application uses the same
DB_DATABASE value for multiple database connections (DB_DATABASEV2 and DB_DATA). This is defined in the configuration file.Troubleshooting
Cannot Connect to Database
If you see database connection errors:- Verify
DB_HOSTandDB_PORTare correct - Ensure the database user has proper privileges
- Check that the database
vlifedgo_dbexists - Confirm MySQL server is running
Application Not Starting
If the server fails to start:- Check if the
PORTis already in use by another process - Verify the
.envfile is in the correct location (project root) - Ensure all required dependencies are installed (
npm install)
Encryption Errors
If you encounter encryption/decryption errors:- Verify the
SUPER_KEYmatches the key used to encrypt existing data - Do not change
SUPER_KEYafter data has been encrypted without proper migration
Related Documentation
- Database Configuration - MySQL connection pool setup
- Session Management - Session store configuration
- Installation Guide - Complete deployment and security guidelines