replace 'core.BASEPORT_WEB_SERVER+338' to 'coretool.PORT_WEB_SERVER_DEV'

This commit is contained in:
陆柯 2022-09-20 14:47:42 +08:00
parent 35684a40f9
commit 7725f2b5cb

View File

@ -16,8 +16,8 @@ const wo = (global.wo = {
], ],
// 最基础的必须的默认配置,如果用户什么也没有提供 // 最基础的必须的默认配置,如果用户什么也没有提供
webProtocol: process.env.NODE_ENV !== 'production' ? 'http' : 'httpall', webProtocol: process.env.NODE_ENV !== 'production' ? 'http' : 'httpall',
webHostname: 'localhost', webHostname: process.env.NODE_ENV !== 'production' ? 'localhost' : 'unknownhost',
webPort: process.env.NODE_ENV !== 'production' ? coretool.BASEPORT_WEB_SERVER + 338 : undefined, webPort: process.env.NODE_ENV !== 'production' ? coretool.PORT_WEB_SERVER_DEV : undefined,
webRoot: process.env.NODE_ENV !== 'production' ? 'unpackage/dist/build/h5' : '_webroot', // local path to serve as webroot webRoot: process.env.NODE_ENV !== 'production' ? 'unpackage/dist/build/h5' : '_webroot', // local path to serve as webroot
webIndex: 'index.html', webIndex: 'index.html',
webSsl: webSsl:
@ -57,7 +57,7 @@ if (typeof wo.envar.webSsl === 'string') {
// communityMember: false, // communityMember: false,
// store: require('greenlock-store-fs'), // store: require('greenlock-store-fs'),
// email: 'ssl@faronear.org', // email: 'ssl@faronear.org',
// approvedDomains: wo.wo.envar.sslDomains, // approvedDomains: wo.envar.sslDomains,
// configDir: path.resolve(__dirname, 'ssl'), // configDir: path.resolve(__dirname, 'ssl'),
// app: server, // app: server,
// }) // })
@ -114,7 +114,7 @@ if (typeof wo.envar.webSsl === 'string') {
let portHttps = wo.envar.webPort || 443 let portHttps = wo.envar.webPort || 443
webServer = require('https') webServer = require('https')
.createServer( .createServer(
// wo.wo.envar.webSsl.type==='greenlock' ? greenlock.httpsOptions : // wo.envar.webSsl.type==='greenlock' ? greenlock.httpsOptions :
{ {
key: fs.readFileSync(wo.envar.webSsl.file.key), key: fs.readFileSync(wo.envar.webSsl.file.key),
cert: fs.readFileSync(wo.envar.webSsl.file.cert), cert: fs.readFileSync(wo.envar.webSsl.file.cert),
@ -132,10 +132,10 @@ if (typeof wo.envar.webSsl === 'string') {
} else if ('httpall' === wo.envar.webProtocol) { } else if ('httpall' === wo.envar.webProtocol) {
let portHttp = wo.envar.webPort?.portHttp || 80 let portHttp = wo.envar.webPort?.portHttp || 80
let portHttps = wo.envar.webPort?.portHttps || 443 let portHttps = wo.envar.webPort?.portHttps || 443
// if (wo.wo.envar.webSsl.type==='greenlock') { // if (wo.envar.webSsl.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.envar.webProtocol}] http=>https://${wo.wo.envar.webHostname}:${portHttp}=>${portHttps} for ${server.settings.env} environment`) // else console.log(`Server listening on [${wo.envar.webProtocol}] http=>https://${wo.envar.webHostname}:${portHttp}=>${portHttps} for ${server.settings.env} environment`)
// }) // })
// }else { // }else {
require('http') require('http')