Configuration Reference
Overview
Configuration can be provided via:
config.jsfile- Environment variables
- Command-line flags
Priority: CLI flags > Environment > Config file
Options
name
Application name.
- Type:
string - Default:
'App' - Env:
APP_NAME
{ name: 'My Application' }port
Server port number.
- Type:
number - Default:
3000 - Env:
PORT
{ port: 8080 }debug
Enable debug mode.
- Type:
boolean - Default:
false - Env:
DEBUG
{ debug: true }database
Database connection settings.
- Type:
object
{ database: { host: 'localhost', port: 5432, name: 'mydb', user: 'admin', password: 'secret', ssl: false, }}| Property | Type | Default | Description |
|---|---|---|---|
host | string | 'localhost' | Database host |
port | number | 5432 | Database port |
name | string | 'app' | Database name |
user | string | - | Username |
password | string | - | Password |
ssl | boolean | false | Use SSL |
cache
Caching configuration.
- Type:
object
{ cache: { enabled: true, driver: 'memory', // 'memory' | 'redis' | 'file' ttl: 3600, }}logging
Logging configuration.
- Type:
object
{ logging: { level: 'info', // 'debug' | 'info' | 'warn' | 'error' format: 'json', // 'json' | 'pretty' output: 'stdout', // 'stdout' | 'file' }}Full Example
export default { name: 'My Application', port: 3000, debug: false,
database: { host: process.env.DB_HOST || 'localhost', port: 5432, name: 'myapp', user: process.env.DB_USER, password: process.env.DB_PASSWORD, },
cache: { enabled: true, driver: 'redis', ttl: 3600, },
logging: { level: 'info', format: 'json', },};