add sslType
This commit is contained in:
@@ -2,6 +2,13 @@ module.exports = {
|
|||||||
protocol: 'http',
|
protocol: 'http',
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: undefined,
|
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: {
|
deploy: {
|
||||||
host: '', // 待部署到的主机
|
host: '', // 待部署到的主机
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ async function init() { /*** 设置全局对象 ***/
|
|||||||
|
|
||||||
const server = express()
|
const server = express()
|
||||||
|
|
||||||
const greenlock = require('greenlock-express').create({
|
const greenlock = (wo.Config.sslType === 'greenlock') ? require('greenlock-express').create({
|
||||||
version: 'draft-11',
|
version: 'draft-11',
|
||||||
server: 'https://acme-v02.api.letsencrypt.org/directory', // for test: acme-staging-v02
|
server: 'https://acme-v02.api.letsencrypt.org/directory', // for test: acme-staging-v02
|
||||||
agreeTos: true,
|
agreeTos: true,
|
||||||
@@ -77,7 +77,7 @@ async function init() { /*** 设置全局对象 ***/
|
|||||||
approvedDomains: wo.Config.sslDomainList,
|
approvedDomains: wo.Config.sslDomainList,
|
||||||
configDir: path.resolve(__dirname, 'ssl'),
|
configDir: path.resolve(__dirname, 'ssl'),
|
||||||
app: server,
|
app: server,
|
||||||
})
|
}) : null
|
||||||
|
|
||||||
/*** 通用中间件 ***/
|
/*** 通用中间件 ***/
|
||||||
server.use(logger('development'===server.get('env')?'dev':'combined'))
|
server.use(logger('development'===server.get('env')?'dev':'combined'))
|
||||||
|
|||||||
Reference in New Issue
Block a user