Repository navigation
Expand file tree
/
Copy pathconfig.js
More file actions
59 lines (42 loc) · 1.41 KB
/
Copy pathconfig.js
File metadata and controls
59 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* api-framework configuration
* Supports environment variable overrides
*/
'use strict'
const path = require('path')
require('dotenv').config()
const cwd = process.cwd()
const config = {
// server port
port: parseInt(process.env.PORT, 10) || 3000,
// server host
host: process.env.HOST || '0.0.0.0',
// static files directory
publicDir: process.env.PUBLIC_DIR || path.join(cwd, 'public'),
// modules directory
moduleDir: process.env.MODULE_DIR || path.join(cwd, 'module'),
// plugins directory
pluginsDir: process.env.PLUGINS_DIR || path.join(cwd, 'plugins'),
// max upload size (MB)
maxUploadSize: parseInt(process.env.MAX_UPLOAD_SIZE, 10) || 100,
// request timeout (ms)
requestTimeout: parseInt(process.env.REQUEST_TIMEOUT, 10) || 30000,
// proxy setting
proxy: process.env.PROXY || '',
// CORS allowed origins (comma separated)
corsAllowOrigin: process.env.CORS_ALLOW_ORIGIN || '*',
// enable cache
enableCache: process.env.ENABLE_CACHE !== 'false',
// cache TTL (seconds)
cacheTTL: parseInt(process.env.CACHE_TTL, 10) || 120,
// enable logging
enableLog: process.env.ENABLE_LOG !== 'false',
// log level: debug, info, warn, error
logLevel: process.env.LOG_LEVEL || 'info',
// custom encryption config (fill in based on target platform)
encrypt: {
key: process.env.ENCRYPT_KEY || '',
iv: process.env.ENCRYPT_IV || '',
},
}
module.exports = config