Skip to content

Commit 08ab621

Browse files
committed
Fixes eslint errors
1 parent 1028de8 commit 08ab621

File tree

2 files changed

+33
-31
lines changed

2 files changed

+33
-31
lines changed

backend/internal/certificate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ const internalCertificate = {
932932

933933
// Prepend the path to the credentials file as an environment variable
934934
if (certificate.meta.dns_provider === 'route53') {
935-
main_cmd = 'AWS_CONFIG_FILE=\'' + credentials_loc + '\' ' + main_cmd;
935+
const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
936+
main_cmd = 'AWS_CONFIG_FILE=\'' + credentials_loc + '\' ' + main_cmd;
936937
}
937938

938939
if (debug_mode) {

backend/setup.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ const fs = require('fs');
22
const NodeRSA = require('node-rsa');
33
const config = require('config');
44
const logger = require('./logger').setup;
5-
const certificateModel = require('./models/certificate');
5+
const certificateModel = require('./models/certificate');
66
const userModel = require('./models/user');
77
const userPermissionModel = require('./models/user_permission');
8-
const utils = require('./lib/utils');
8+
const utils = require('./lib/utils');
99
const authModel = require('./models/auth');
1010
const settingModel = require('./models/setting');
1111
const dns_plugins = require('./global/certbot-dns-plugins');
@@ -165,34 +165,35 @@ const setupDefaultSettings = () => {
165165
*/
166166
const setupCertbotPlugins = () => {
167167
return certificateModel
168-
.query()
169-
.where('is_deleted', 0)
170-
.andWhere('provider', 'letsencrypt')
171-
.then((certificates) => {
172-
if (certificates && certificates.length) {
173-
let plugins = [];
174-
let promises = [];
175-
176-
certificates.map(function (certificate) {
177-
if (certificate.meta && certificate.meta.dns_challenge === true) {
178-
const dns_plugin = dns_plugins[certificate.meta.dns_provider];
179-
const package = `${dns_plugin.package_name}==${dns_plugin.package_version}`;
180-
if (plugins.indexOf(package) === -1) plugins.push(package);
181-
182-
// Make sure credentials file exists
183-
const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
184-
const credentials_cmd = '[ -f \'' + credentials_loc + '\' ] || { mkdir /etc/letsencrypt/credentials; echo \'' + certificate.meta.dns_provider_credentials.replace('\'', '\\\'') + '\' > \'' + credentials_loc + '\' && chmod 600 \'' + credentials_loc + '\'; }';
185-
promises.push(utils.exec(credentials_cmd));
186-
}
187-
});
188-
189-
const install_cmd = 'pip3 install ' + plugins.join(' ');
190-
promises.push(utils.exec(install_cmd));
191-
return Promise.all(promises).then(() => {
192-
logger.info('Added Certbot plugins ' + plugins.join(', '));
193-
});
194-
}
195-
});
168+
.query()
169+
.where('is_deleted', 0)
170+
.andWhere('provider', 'letsencrypt')
171+
.then((certificates) => {
172+
if (certificates && certificates.length) {
173+
let plugins = [];
174+
let promises = [];
175+
176+
certificates.map(function (certificate) {
177+
if (certificate.meta && certificate.meta.dns_challenge === true) {
178+
const dns_plugin = dns_plugins[certificate.meta.dns_provider];
179+
const package_to_install = `${dns_plugin.package_name}==${dns_plugin.package_version}`;
180+
181+
if (plugins.indexOf(package_to_install) === -1) plugins.push(package_to_install);
182+
183+
// Make sure credentials file exists
184+
const credentials_loc = '/etc/letsencrypt/credentials/credentials-' + certificate.id;
185+
const credentials_cmd = '[ -f \'' + credentials_loc + '\' ] || { mkdir /etc/letsencrypt/credentials; echo \'' + certificate.meta.dns_provider_credentials.replace('\'', '\\\'') + '\' > \'' + credentials_loc + '\' && chmod 600 \'' + credentials_loc + '\'; }';
186+
promises.push(utils.exec(credentials_cmd));
187+
}
188+
});
189+
190+
const install_cmd = 'pip3 install ' + plugins.join(' ');
191+
promises.push(utils.exec(install_cmd));
192+
return Promise.all(promises).then(() => {
193+
logger.info('Added Certbot plugins ' + plugins.join(', '));
194+
});
195+
}
196+
});
196197
};
197198

198199
module.exports = function () {

0 commit comments

Comments
 (0)