From 6cdf2f1fb6badbe16722075fba08d6abed7246b9 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Mon, 19 Sep 2022 00:57:21 +0800 Subject: [PATCH] define 'inProd' as shortcut instead of process.env.NODE_ENV==='production' --- envar-web-basic.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/envar-web-basic.js b/envar-web-basic.js index 8edf77d..04e123b 100644 --- a/envar-web-basic.js +++ b/envar-web-basic.js @@ -1,12 +1,18 @@ -const inDev = global.envar?.inDev || process.env.NODE_ENV !== 'production' // 用 production 测试,防止 NODE_ENV 未定义 +const coretool = require('wo-core-toolkit') module.exports = { - protocol: inDev ? 'http' : 'httpall', - host: inDev ? 'localhost' : 'vic-user.bittic.org', - port: undefined, - sslType: 'file', // greenlock or file - sslDomainList: ['vic-user.bittic.org'], - sslKey: '/etc/letsencrypt/live/vic-server.bittic.org/privkey.pem', // ssl key file, - sslCert: '/etc/letsencrypt/live/vic-server.bittic.org/fullchain.pem', // ssl cert file, - sslCA: '/etc/letsencrypt/live/vic-server.bittic.org/bundle.pem', // ssl ca file, + webProtocol: inProd ? 'httpall' : 'http', + webHostname: inProd ? 'vic-user.bittic.org' : 'localhost', + webPort: inProd ? undefined : coretool.BASEPORT_WEB_SERVER + 338, + webRoot: 'dist', + webSsl: inProd + ? { + type: 'file', // greenlock or file + file: { + key: './ssl/privkey.pem', // ssl key file, + cert: './ssl/fullchain.pem', // ssl cert file, + ca: './ssl/chain.pem', // ssl ca file, + }, + } + : undefined, }