add sslType

This commit is contained in:
luk.lu
2019-07-01 22:53:51 +08:00
parent 71215e236f
commit 77d40aeb42
2 changed files with 9 additions and 2 deletions

View File

@@ -2,6 +2,13 @@ module.exports = {
protocol: 'http',
host: 'localhost',
port: undefined,
// 如果使用 https 协议,必须填写以下内容,或在命令行参数中设置:
sslType: 'file', // file|greenlock
sslDomainList: [],
sslKey: 'ssl/privkey.pem', // ssl key file,
sslCert: 'ssl/fullchain.pem', // ssl cert file,
sslCA: 'ssl/client-cert.pem', // ssl ca file,
deploy: {
host: '', // 待部署到的主机

View File

@@ -67,7 +67,7 @@ async function init() { /*** 设置全局对象 ***/
const server = express()
const greenlock = require('greenlock-express').create({
const greenlock = (wo.Config.sslType === 'greenlock') ? require('greenlock-express').create({
version: 'draft-11',
server: 'https://acme-v02.api.letsencrypt.org/directory', // for test: acme-staging-v02
agreeTos: true,
@@ -77,7 +77,7 @@ async function init() { /*** 设置全局对象 ***/
approvedDomains: wo.Config.sslDomainList,
configDir: path.resolve(__dirname, 'ssl'),
app: server,
})
}) : null
/*** 通用中间件 ***/
server.use(logger('development'===server.get('env')?'dev':'combined'))