rename 'from' to 'webroot'

This commit is contained in:
陆柯 2021-09-05 13:47:51 +08:00
parent 90202815d5
commit cf47c24274

View File

@ -10,13 +10,13 @@ const wo = (global.wo = {
['protocol', '-P, --protocol <string>', 'Web Server protocol: http|https|httpall.'], ['protocol', '-P, --protocol <string>', 'Web Server protocol: http|https|httpall.'],
['host', '-H, --host <string>', 'Host IP or domain name, default to localhost.'], ['host', '-H, --host <string>', 'Host IP or domain name, default to localhost.'],
['port', '-p, --port <number>', 'HTTP port number.'], ['port', '-p, --port <number>', 'HTTP port number.'],
['from', '-f, --from <string>', 'Path to serve as website'], ['webroot', '-w, --webroot <string>', 'Path to serve as website'],
['ssl', '--ssl <string>', 'SSL options in JSON string.'], ['ssl', '--ssl <string>', 'SSL options in JSON string.'],
], ],
// 最基础的必须的默认配置,如果用户什么也没有提供 // 最基础的必须的默认配置,如果用户什么也没有提供
protocol: 'http', protocol: 'http',
host: 'localhost', host: 'localhost',
from: './www', // local path to serve as webroot webroot: 'webroot', // local path to serve as webroot
// 如果使用虚拟主机 // 如果使用虚拟主机
/* /*
vhosts: [ vhosts: [
@ -59,7 +59,7 @@ if (typeof wo.envi.ssl === 'string') {
// 所以,如果 vhost匹配了域名且static找到了文件就结束了。如果 vhost 匹配了域名但static找不到文件就继续往下。 // 所以,如果 vhost匹配了域名且static找到了文件就结束了。如果 vhost 匹配了域名但static找不到文件就继续往下。
if (!wo.envi.vhosts) { if (!wo.envi.vhosts) {
server.use( server.use(
express.static(path.join(process.cwd(), wo.envi.from), { express.static(path.join(process.cwd(), wo.envi.webroot), {
index: 'index.html', index: 'index.html',
}) })
) )