-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfig.js
More file actions
55 lines (43 loc) · 1.16 KB
/
config.js
File metadata and controls
55 lines (43 loc) · 1.16 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
const argvs = require('minimist')(process.argv.slice(2));
const isProd = argvs.prod !== false;
[argvs.env, process.env.NODE_ENV].some((item) => {
// 统一环境写法
item = {
'development': 'dev',
'pre-release': 'pre',
'production': 'prod'
}[item] || item;
if (['dev', 'test', 'pre', 'prod'].indexOf(item) !== -1) {
process.env.NODE_ENV = isProd ? 'production' : 'development';
process.env.BACK2FRONT_ENV = item;
return true;
}
});
const path = require('path');
module.exports = {
// 环境
env: process.env.BACK2FRONT_ENV,
nodeEnv: process.env.NODE_ENV,
// 占用的端口
port: 3000,
// 本应用发布后是否作为静态文件服务器
isStaticServer: true,
// 静态文件设置
static: {
maxAge: isProd ? 30 * 24 * 60 * 60 * 1000 : 0
},
// 前后端同构的XTemplate指令模块(路径相对于 lib/xtpl.js)
xTplCommands: '../public/assets/xtpl/commands',
// 上传文件目录
uploadDir: path.resolve('./upload'),
// 编辑器内容区CSS
contentCSS: path.resolve('public/contentCSS.css'),
// 数据库配置
database: {
host: 'localhost',
port: 3306,
user: 'root',
password: '12345',
database: 'letsblog'
}
};