Browse Source

revert async code

pull/123/head
butlerx 7 years ago
committed by cbutler
parent
commit
222be6529c
No known key found for this signature in database GPG Key ID: 9EB3D625BD14DDEC
  1. 26
      cli.js

26
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)),
};
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);
}
return {};
} catch (err) {
throw err;
}
resolve(ssl);
});
}

Loading…
Cancel
Save