纠正:无论有没有用户配置,都要Object.assign(最基础配置,用户配置)

This commit is contained in:
Luk Lu
2020-05-30 14:25:22 +08:00
parent c432743461
commit b99923cd90
2 changed files with 12 additions and 5 deletions

View File

@@ -1,9 +1,8 @@
const fs = require('fs')
const path = require('path')
const Config = require('so.base/Config.js')
if (!Config || Object.keys(Config).length===0) {
Config = { // 默认配置,如果用户什么也没有提供
const Config = Object.assign({
// 最基础的必须的默认配置,如果用户什么也没有提供
protocol: 'http',
host: 'localhost',
from: './dist', // local path to serve as webroot
@@ -13,8 +12,9 @@ if (!Config || Object.keys(Config).length===0) {
{ webroot: 'dist', webindex: 'index.html', domainList: ['']}
],
*/
}
}
},
require('so.base/Config.js')
)
if (typeof(Config.ssl)==='string') {
Config.ssl = eval(`(${Config.ssl})`)
}