butlerx
7 years ago
committed by
cbutler
No known key found for this signature in database
GPG Key ID: 9EB3D625BD14DDEC
1 changed files with
16 additions and
10 deletions
-
cli.js
|
|
@ -74,16 +74,22 @@ tty.on('disconnect', () => { |
|
|
|
console.log('disconnect'); |
|
|
|
}); |
|
|
|
|
|
|
|
async function loadSSL({ sslkey, sslcert }) { |
|
|
|
try { |
|
|
|
function loadSSL({ sslkey, sslcert }) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const ssl = {}; |
|
|
|
if (sslkey && sslcert) { |
|
|
|
return { |
|
|
|
key : await fs.readFile(path.resolve(sslkey)), |
|
|
|
cert: await fs.readFile(path.resolve(sslcert)), |
|
|
|
}; |
|
|
|
} |
|
|
|
return {}; |
|
|
|
} catch (err) { |
|
|
|
throw err; |
|
|
|
fs |
|
|
|
.readFile(path.resolve(sslkey)) |
|
|
|
.then(key => { |
|
|
|
ssl.key = key; |
|
|
|
}) |
|
|
|
.then(fs.readFile(path.resolve(sslcert))) |
|
|
|
.then(cert => { |
|
|
|
ssl.cert = cert; |
|
|
|
}) |
|
|
|
.then(resolve(ssl)) |
|
|
|
.catch(reject); |
|
|
|
} |
|
|
|
resolve(ssl); |
|
|
|
}); |
|
|
|
} |
|
|
|