rename Web_Host to Web_Hostname

This commit is contained in:
陆柯 2022-04-03 14:10:48 +08:00
parent b1e21fd087
commit 6c387470b0

View File

@ -7,14 +7,14 @@ const wo = (global.wo = {
Commander_Option_List: [ Commander_Option_List: [
// 命令行里可以接受的参数。将传给 config.js 里的 commander。每个参数的定义格式是 [参数名,参数键,描述]后两者用于传给commander取值后覆盖掉Config里的同名变量。 // 命令行里可以接受的参数。将传给 config.js 里的 commander。每个参数的定义格式是 [参数名,参数键,描述]后两者用于传给commander取值后覆盖掉Config里的同名变量。
['Web_Protocol', '-P, --Web_Protocol <string>', 'Web protocol: http|https|httpall.'], ['Web_Protocol', '-P, --Web_Protocol <string>', 'Web protocol: http|https|httpall.'],
['Web_Host', '-H, --Web_Host <string>', 'Host IP or domain name.'], ['Web_Hostname', '-H, --Web_Hostname <string>', 'Host IP or domain name.'],
['Web_Port', '-p, --Web_Port <number>', 'HTTP port number.'], ['Web_Port', '-p, --Web_Port <number>', 'HTTP port number.'],
['Web_Root', '-w, --Web_Root <string>', 'Path to serve as website.'], ['Web_Root', '-w, --Web_Root <string>', 'Path to serve as website.'],
['Web_Ssl', '--Web_Ssl <string>', 'SSL options in JSON string.'], ['Web_Ssl', '--Web_Ssl <string>', 'SSL options in JSON string.'],
], ],
// 最基础的必须的默认配置,如果用户什么也没有提供 // 最基础的必须的默认配置,如果用户什么也没有提供
Web_Protocol: 'http', Web_Protocol: 'http',
Web_Host: 'localhost', Web_Hostname: 'localhost',
Web_Root: '_webroot', // local path to serve as webroot Web_Root: '_webroot', // local path to serve as webroot
Web_Index: 'index.html', Web_Index: 'index.html',
// 如果使用虚拟主机 // 如果使用虚拟主机
@ -92,7 +92,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
console.error(err) console.error(err)
} else { } else {
console.log({time: new Date().toJSON()}, console.log({time: new Date().toJSON()},
`Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Host}:${portHttp} for ${wo.envi.prodev} environment` `Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Hostname}:${portHttp} for ${wo.envi.prodev} environment`
) )
} }
}) })
@ -113,7 +113,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
console.error(err) console.error(err)
} else { } else {
console.log({time: new Date().toJSON()}, console.log({time: new Date().toJSON()},
`Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Host}:${portHttps} for ${wo.envi.prodev} environment` `Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Hostname}:${portHttps} for ${wo.envi.prodev} environment`
) )
} }
}) })
@ -123,7 +123,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
// if (wo.wo.envi.Web_Ssl.type==='greenlock') { // if (wo.wo.envi.Web_Ssl.type==='greenlock') {
// greenlock.listen(portHttp, portHttps, function (err) { // greenlock.listen(portHttp, portHttps, function (err) {
// if (err) console.error(err) // if (err) console.error(err)
// else console.log(`Server listening on [${wo.wo.envi.Web_Protocol}] http=>https://${wo.wo.envi.Web_Host}:${portHttp}=>${portHttps} for ${server.settings.env} environment`) // else console.log(`Server listening on [${wo.wo.envi.Web_Protocol}] http=>https://${wo.wo.envi.Web_Hostname}:${portHttp}=>${portHttps} for ${server.settings.env} environment`)
// }) // })
// }else { // }else {
require('http') require('http')
@ -137,7 +137,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
console.error(err) console.error(err)
} else { } else {
console.log({time: new Date().toJSON()}, console.log({time: new Date().toJSON()},
`Server redirecting from http://${wo.envi.Web_Host}:${portHttp} for ${ `Server redirecting from http://${wo.envi.Web_Hostname}:${portHttp} for ${
wo.envi.prodev wo.envi.prodev
} environment` } environment`
) )
@ -157,7 +157,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
console.error(err) console.error(err)
} else { } else {
console.log({time: new Date().toJSON()}, console.log({time: new Date().toJSON()},
`Server listening on https://${wo.envi.Web_Host}:${portHttps} for ${ `Server listening on https://${wo.envi.Web_Hostname}:${portHttps} for ${
wo.envi.prodev wo.envi.prodev
} environment` } environment`
) )
@ -175,7 +175,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
console.error(err) console.error(err)
} else { } else {
console.log({time: new Date().toJSON()}, console.log({time: new Date().toJSON()},
`Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Host}:${portHttp} for ${wo.envi.prodev} environment` `Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Hostname}:${portHttp} for ${wo.envi.prodev} environment`
) )
} }
}) })
@ -201,7 +201,7 @@ if (typeof wo.envi.Web_Ssl === 'string') {
console.error(err) console.error(err)
} else { } else {
console.log({time: new Date().toJSON()}, console.log({time: new Date().toJSON()},
`Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Host}:${portHttps} for ${wo.envi.prodev} environment` `Server listening on ${wo.envi.Web_Protocol}://${wo.envi.Web_Hostname}:${portHttps} for ${wo.envi.prodev} environment`
) )
} }
}) })