fixed linting

This commit is contained in:
Rahul Somasundaram 2021-08-23 09:17:42 +05:30
parent e5a3b5ee2f
commit 7b67ef3015
No known key found for this signature in database
GPG Key ID: D6DAC16BA31FD0C5

View File

@ -13,7 +13,7 @@ const internalHost = require('./host');
const letsencryptStaging = process.env.NODE_ENV !== 'production'; const letsencryptStaging = process.env.NODE_ENV !== 'production';
const letsencryptConfig = '/etc/letsencrypt.ini'; const letsencryptConfig = '/etc/letsencrypt.ini';
const certbotCommand = 'certbot'; const certbotCommand = 'certbot';
const archiver = require('archiver'); const archiver = require('archiver');
function omissions() { function omissions() {
return ['is_deleted']; return ['is_deleted'];
@ -336,49 +336,49 @@ const internalCertificate = {
}); });
}, },
/** /**
* @param {Object} data * @param {Object} data
* @param {Number} data.id * @param {Number} data.id
* @returns {Promise} * @returns {Promise}
*/ */
download: (data) => { download: (data) => {
const downloadName = "npm-" + data.id + "-" + `${Date.now()}.zip`; const downloadName = 'npm-' + data.id + '-' + `${Date.now()}.zip`;
const opName = '/tmp/' + downloadName; const opName = '/tmp/' + downloadName;
const zipDirectory = "/etc/letsencrypt/live/npm-" + data.id const zipDirectory = '/etc/letsencrypt/live/npm-' + data.id;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
internalCertificate.zipDirectory(zipDirectory, opName) internalCertificate.zipDirectory(zipDirectory, opName)
.then(() => { .then(() => {
logger.debug("zip completed : ", opName) logger.debug('zip completed : ', opName);
const resp = { const resp = {
fileName: opName fileName: opName
} };
resolve(resp) resolve(resp);
}).catch(err => { }).catch((err) => {
reject(err) reject(err);
}) });
}); });
}, },
/** /**
* @param {String} source * @param {String} source
* @param {String} out * @param {String} out
* @returns {Promise} * @returns {Promise}
*/ */
zipDirectory(source, out) { zipDirectory(source, out) {
const archive = archiver('zip', { zlib: { level: 9 } }); const archive = archiver('zip', { zlib: { level: 9 } });
const stream = fs.createWriteStream(out); const stream = fs.createWriteStream(out);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
archive archive
.directory(source, false) .directory(source, false)
.on('error', err => reject(err)) .on('error', (err) => reject(err))
.pipe(stream); .pipe(stream);
stream.on('close', () => resolve()); stream.on('close', () => resolve());
archive.finalize(); archive.finalize();
}); });
}, },
/** /**
* @param {Access} access * @param {Access} access