Improvements from Codacy.
This commit is contained in:
parent
371e95fd22
commit
8e4088603f
24
clean.js
24
clean.js
|
@ -1,13 +1,13 @@
|
||||||
console.log('Emptying the bucket.');
|
console.log("Emptying the bucket.");
|
||||||
|
|
||||||
require('dotenv').config();
|
require("dotenv").config();
|
||||||
|
|
||||||
var accessKeyId = process.env.AWS_ACCESS_KEY_ID
|
let accessKeyId = process.env.AWS_ACCESS_KEY_ID
|
||||||
secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY
|
, secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY
|
||||||
regionName = process.env.AWS_BUCKET_REGION
|
, regionName = process.env.AWS_BUCKET_REGION
|
||||||
bucketName = process.env.AWS_BUCKET_NAME
|
, bucketName = process.env.AWS_BUCKET_NAME
|
||||||
|
|
||||||
var AWS = require('aws-sdk');
|
var AWS = require("aws-sdk");
|
||||||
AWS.config.setPromisesDependency(Promise);
|
AWS.config.setPromisesDependency(Promise);
|
||||||
AWS.config.update({
|
AWS.config.update({
|
||||||
region: regionName
|
region: regionName
|
||||||
|
@ -17,13 +17,13 @@ AWS.config.update({
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const s3 = new AWS.S3({ apiVersion: '2006-03-01' });
|
const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
|
||||||
|
|
||||||
s3.listObjects({ Bucket: bucketName }).promise().then((data) => {
|
s3.listObjects({ Bucket: bucketName }).promise().then((data) => {
|
||||||
|
|
||||||
if (data.Contents.length <= 0) {
|
if (data.Contents.length <= 0) {
|
||||||
console.log('Your bucket is already empty :)');
|
console.log("Your bucket is already empty :)");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var objectKeys = [];
|
var objectKeys = [];
|
||||||
|
@ -31,11 +31,11 @@ s3.listObjects({ Bucket: bucketName }).promise().then((data) => {
|
||||||
for (let i = 0; i < data.Contents.length; i++) {
|
for (let i = 0; i < data.Contents.length; i++) {
|
||||||
objectKeys.push({
|
objectKeys.push({
|
||||||
Key: data.Contents[i].Key
|
Key: data.Contents[i].Key
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
s3.deleteObjects({ Delete: { Objects: objectKeys }, Bucket: bucketName }).promise().then((data) => {
|
s3.deleteObjects({ Delete: { Objects: objectKeys }, Bucket: bucketName }).promise().then((data) => {
|
||||||
console.log('Your bucket was emptied :)');
|
console.log("Your bucket was emptied :)");
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
throw err;
|
throw err;
|
||||||
|
|
32
index.js
32
index.js
|
@ -1,7 +1,7 @@
|
||||||
var path = require('path');
|
var path = require("path");
|
||||||
var Promise = require('bluebird')
|
var Promise = require("bluebird");
|
||||||
|
|
||||||
const AWS = require('aws-sdk');
|
const AWS = require("aws-sdk");
|
||||||
AWS.config.setPromisesDependency(Promise);
|
AWS.config.setPromisesDependency(Promise);
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
|
@ -9,14 +9,14 @@ const defaultOptions = {
|
||||||
, secretAccessKey: null
|
, secretAccessKey: null
|
||||||
, bucketName: null
|
, bucketName: null
|
||||||
, bucketRegion: null
|
, bucketRegion: null
|
||||||
, accountsDir: 'accounts/'
|
, accountsDir: "accounts/"
|
||||||
, configDir: 'acme/'
|
, configDir: "acme/"
|
||||||
}
|
}
|
||||||
|
|
||||||
const s3 = new AWS.S3({ apiVersion: '2006-03-01' });
|
const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
|
||||||
|
|
||||||
const pathHelper = require('./lib/pathHelper');
|
const pathHelper = require("./lib/pathHelper");
|
||||||
const fileNames = require('./lib/fileNames');
|
const fileNames = require("./lib/fileNames");
|
||||||
|
|
||||||
module.exports.create = (createOptions) => {
|
module.exports.create = (createOptions) => {
|
||||||
|
|
||||||
|
@ -39,30 +39,30 @@ module.exports.create = (createOptions) => {
|
||||||
const handlers = {
|
const handlers = {
|
||||||
certificates: {
|
certificates: {
|
||||||
check: (opts) => {
|
check: (opts) => {
|
||||||
return require('./lib/certificates/check').check(opts, options, s3);
|
return require("./lib/certificates/check").check(opts, options, s3);
|
||||||
},
|
},
|
||||||
checkKeypair: (opts) => {
|
checkKeypair: (opts) => {
|
||||||
return require('./lib/certificates/checkKeypair').checkKeypair(opts, options, s3);
|
return require("./lib/certificates/checkKeypair").checkKeypair(opts, options, s3);
|
||||||
},
|
},
|
||||||
setKeypair: (opts) => {
|
setKeypair: (opts) => {
|
||||||
return require('./lib/certificates/setKeypair').setKeypair(opts, options, s3);
|
return require("./lib/certificates/setKeypair").setKeypair(opts, options, s3);
|
||||||
},
|
},
|
||||||
set: (opts) => {
|
set: (opts) => {
|
||||||
return require('./lib/certificates/set').set(opts, options, s3);
|
return require("./lib/certificates/set").set(opts, options, s3);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
accounts: {
|
accounts: {
|
||||||
check: (opts) => {
|
check: (opts) => {
|
||||||
return require('./lib/accounts/check').check(opts, options, s3);
|
return require("./lib/accounts/check").check(opts, options, s3);
|
||||||
},
|
},
|
||||||
checkKeypair: (opts) => {
|
checkKeypair: (opts) => {
|
||||||
return require('./lib/accounts/checkKeypair').checkKeypair(opts, options, s3);
|
return require("./lib/accounts/checkKeypair").checkKeypair(opts, options, s3);
|
||||||
},
|
},
|
||||||
setKeypair: (opts) => {
|
setKeypair: (opts) => {
|
||||||
return require('./lib/accounts/setKeypair').setKeypair(opts, options, s3);
|
return require("./lib/accounts/setKeypair").setKeypair(opts, options, s3);
|
||||||
},
|
},
|
||||||
set: (opts) => {
|
set: (opts) => {
|
||||||
return require('./lib/accounts/set').set(opts, options, s3);
|
return require("./lib/accounts/set").set(opts, options, s3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.check = (opts, options, s3) => {
|
module.exports.check = (opts, options, s3) => {
|
||||||
console.log("accounts.check", opts.account.id);
|
console.log("accounts.check", opts.account.id);
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.checkKeypair = (opts, options, s3) => {
|
module.exports.checkKeypair = (opts, options, s3) => {
|
||||||
var id = opts.account.id || opts.email || 'single-user';
|
let id = opts.account.id || opts.email || "single-user";
|
||||||
console.log('accounts.checkKeypair for', id);
|
console.log("accounts.checkKeypair for", id);
|
||||||
|
|
||||||
key = pathHelper.accountsPath(options, id)
|
let key = pathHelper.accountsPath(options, id);
|
||||||
|
|
||||||
return s3.getObject({ Key: key, Bucket: options.bucketName }).promise().then((data) => {
|
return s3.getObject({ Key: key, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully retrieved account keypair.');
|
console.log("Successfully retrieved account keypair.");
|
||||||
var keypair = JSON.parse(data.Body.toString());
|
let keypair = JSON.parse(data.Body.toString());
|
||||||
return {
|
return {
|
||||||
privateKeyPem: keypair.privateKeyPem // string PEM private key
|
privateKeyPem: keypair.privateKeyPem // string PEM private key
|
||||||
, privateKeyJwk: keypair.privateKeyJwk // object JWK private key
|
, privateKeyJwk: keypair.privateKeyJwk // object JWK private key
|
||||||
};
|
};
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error retrieving your account keypair:', err.message);
|
console.error("There was an error retrieving your account keypair:", err.message);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.set = (opts, options, s3) => {
|
module.exports.set = (opts, options, s3) => {
|
||||||
console.log("accounts.set");
|
console.log("accounts.set");
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.setKeypair = (opts, options, s3) => {
|
module.exports.setKeypair = (opts, options, s3) => {
|
||||||
console.log('accounts.setKeypair for', opts.account);
|
console.log("accounts.setKeypair for", opts.account);
|
||||||
|
|
||||||
var id = opts.account.id || opts.email || 'single-user';
|
let id = opts.account.id || opts.email || "single-user";
|
||||||
key = pathHelper.accountsPath(options, id)
|
let key = pathHelper.accountsPath(options, id)
|
||||||
|
|
||||||
var body = JSON.stringify({
|
var body = JSON.stringify({
|
||||||
privateKeyPem: opts.keypair.privateKeyPem // string PEM
|
privateKeyPem: opts.keypair.privateKeyPem // string PEM
|
||||||
|
@ -13,10 +13,10 @@ module.exports.setKeypair = (opts, options, s3) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
return s3.putObject({ Key: key, Body: body, Bucket: options.bucketName }).promise().then((data) => {
|
return s3.putObject({ Key: key, Body: body, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully created account keypair.');
|
console.log("Successfully created account keypair.");
|
||||||
return null;
|
return null;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error creating account keypair:', err.message);
|
console.error("There was an error creating account keypair:", err.message);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.check = (opts, options, s3) => {
|
module.exports.check = (opts, options, s3) => {
|
||||||
var id = opts.certificate && opts.certificate.id || opts.subject;
|
var id = opts.certificate && opts.certificate.id || opts.subject;
|
||||||
console.log('certificates.check for', opts.subject);
|
console.log("certificates.check for", opts.subject);
|
||||||
|
|
||||||
var privkeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);
|
var privkeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);
|
||||||
var certPath = pathHelper.certificatesPath(options, id, fileNames.cert);
|
var certPath = pathHelper.certificatesPath(options, id, fileNames.cert);
|
||||||
|
@ -11,24 +11,24 @@ module.exports.check = (opts, options, s3) => {
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
s3.getObject({ Key: privkeyPath, Bucket: options.bucketName }).promise().then((data) => {
|
s3.getObject({ Key: privkeyPath, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully retrieved certificate privkey.pem');
|
console.log("Successfully retrieved certificate privkey.pem");
|
||||||
return data.Body.toString();
|
return data.Body.toString();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error retrieving your certificate privkey.pem:', err.message);
|
console.error("There was an error retrieving your certificate privkey.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
s3.getObject({ Key: certPath, Bucket: options.bucketName }).promise().then((data) => {
|
s3.getObject({ Key: certPath, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully retrieved certificate cert.pem');
|
console.log("Successfully retrieved certificate cert.pem");
|
||||||
return data.Body.toString();
|
return data.Body.toString();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error retrieving your certificate cert.pem:', err.message);
|
console.error("There was an error retrieving your certificate cert.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
s3.getObject({ Key: chainPath, Bucket: options.bucketName }).promise().then((data) => {
|
s3.getObject({ Key: chainPath, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully retrieved certificate chain.pem');
|
console.log("Successfully retrieved certificate chain.pem");
|
||||||
return data.Body.toString();
|
return data.Body.toString();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error retrieving your certificate chain.pem:', err.message);
|
console.error("There was an error retrieving your certificate chain.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
]).then((values) => {
|
]).then((values) => {
|
||||||
|
@ -38,7 +38,7 @@ module.exports.check = (opts, options, s3) => {
|
||||||
, chain: values[2]
|
, chain: values[2]
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error checking the ceritifcates:', err.message);
|
console.error("There was an error checking the ceritifcates:", err.message);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
};
|
|
@ -1,21 +1,21 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.checkKeypair = (opts, options, s3) => {
|
module.exports.checkKeypair = (opts, options, s3) => {
|
||||||
console.log('certificates.checkKeypair for', opts.subject);
|
console.log("certificates.checkKeypair for", opts.subject);
|
||||||
|
|
||||||
id = opts.certificate.kid || opts.certificate.id || opts.subject;
|
let id = opts.certificate.kid || opts.certificate.id || opts.subject;
|
||||||
|
|
||||||
pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);
|
pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);
|
||||||
jwkKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.jwk);
|
jwkKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.jwk);
|
||||||
|
|
||||||
return s3.getObject({ Key: pemKeyPath, Bucket: options.bucketName }).promise().then((data) => {
|
return s3.getObject({ Key: pemKeyPath, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully retrieved certificate PEM keypair.');
|
console.log("Successfully retrieved certificate PEM keypair.");
|
||||||
return {
|
return {
|
||||||
privateKeyPem: data.Body.toString()
|
privateKeyPem: data.Body.toString()
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error retrieving your certificate PEM keypair:', err.message);
|
console.error("There was an error retrieving your certificate PEM keypair:", err.message);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.set = (opts, options, s3) => {
|
module.exports.set = (opts, options, s3) => {
|
||||||
console.log('certificates.set for ', opts.subject);
|
console.log("certificates.set for ", opts.subject);
|
||||||
|
|
||||||
var pems = {
|
var pems = {
|
||||||
cert: opts.pems.cert
|
cert: opts.pems.cert
|
||||||
|
@ -15,38 +15,38 @@ module.exports.set = (opts, options, s3) => {
|
||||||
var fullchainPath = pathHelper.certificatesPath(options, opts.subject, fileNames.fullchain);
|
var fullchainPath = pathHelper.certificatesPath(options, opts.subject, fileNames.fullchain);
|
||||||
var bundlePath = pathHelper.certificatesPath(options, opts.subject, fileNames.bundle);
|
var bundlePath = pathHelper.certificatesPath(options, opts.subject, fileNames.bundle);
|
||||||
|
|
||||||
var fullchainPem = [pems.cert, pems.chain].join('\n'); // for Apache, Nginx, etc
|
var fullchainPem = [pems.cert, pems.chain].join("\n"); // for Apache, Nginx, etc
|
||||||
var bundlePem = [pems.privkey, pems.cert, pems.chain].join('\n'); // for HAProxy
|
var bundlePem = [pems.privkey, pems.cert, pems.chain].join("\n"); // for HAProxy
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
s3.putObject({ Key: certPath, Body: pems.cert, Bucket: options.bucketName }).promise().then((data) => {
|
s3.putObject({ Key: certPath, Body: pems.cert, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully set', certPath);
|
console.log("Successfully set", certPath);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error setting cert.pem:', err.message);
|
console.error("There was an error setting cert.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
s3.putObject({ Key: chainPath, Body: pems.chain, Bucket: options.bucketName }).promise().then((data) => {
|
s3.putObject({ Key: chainPath, Body: pems.chain, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully set', chainPath);
|
console.log("Successfully set", chainPath);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error setting chain.pem:', err.message);
|
console.error("There was an error setting chain.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
s3.putObject({ Key: fullchainPath, Body: fullchainPem, Bucket: options.bucketName }).promise().then((data) => {
|
s3.putObject({ Key: fullchainPath, Body: fullchainPem, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully set', fullchainPath);
|
console.log("Successfully set", fullchainPath);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error setting fullchain.pem:', err.message);
|
console.error("There was an error setting fullchain.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
s3.putObject({ Key: bundlePath, Body: bundlePem, Bucket: options.bucketName }).promise().then((data) => {
|
s3.putObject({ Key: bundlePath, Body: bundlePem, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully set', bundlePath);
|
console.log("Successfully set", bundlePath);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error setting bundle.pem:', err.message);
|
console.error("There was an error setting bundle.pem:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
]).then((values) => {
|
]).then((values) => {
|
||||||
return null;
|
return null;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error setting the certificates:', err.message);
|
console.error("There was an error setting the certificates:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
const pathHelper = require('../pathHelper');
|
const pathHelper = require("../pathHelper");
|
||||||
const fileNames = require('../fileNames');
|
const fileNames = require("../fileNames");
|
||||||
|
|
||||||
module.exports.setKeypair = (opts, options, s3) => {
|
module.exports.setKeypair = (opts, options, s3) => {
|
||||||
id = opts.certificate.kid || opts.certificate.id || opts.subject;
|
let id = opts.certificate.kid || opts.certificate.id || opts.subject;
|
||||||
console.log('certificates.setKeypair for', id);
|
console.log("certificates.setKeypair for", id);
|
||||||
|
|
||||||
pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);
|
let pemKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.pem);
|
||||||
jwkKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.jwk);
|
let jwkKeyPath = pathHelper.certificatesPath(options, id, fileNames.privkey.jwk);
|
||||||
|
|
||||||
return s3.putObject({ Key: pemKeyPath, Body: opts.keypair.privateKeyPem, Bucket: options.bucketName }).promise().then((data) => {
|
return s3.putObject({ Key: pemKeyPath, Body: opts.keypair.privateKeyPem, Bucket: options.bucketName }).promise().then((data) => {
|
||||||
console.log('Successfully set the PEM privateKey.');
|
console.log("Successfully set the PEM privateKey.");
|
||||||
return null;
|
return null;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('There was an error setting your PEM privateKey:', err.message);
|
console.error("There was an error setting your PEM privateKey:", err.message);
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,21 +1,21 @@
|
||||||
const path = require('path');
|
const path = require("path");
|
||||||
|
|
||||||
tameWild = (wild) => {
|
tameWild = (wild) => {
|
||||||
return wild.replace(/\*/g, '_');
|
return wild.replace(/\*/g, "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
certificatesPath: (options, id, fileName) => {
|
certificatesPath: (options, id, fileName) => {
|
||||||
var filePath = path.join(options.configDir, 'live', tameWild(id), fileName);
|
var filePath = path.join(options.configDir, "live", tameWild(id), fileName);
|
||||||
console.log('filePath:', filePath);
|
console.log("filePath:", filePath);
|
||||||
return filePath;
|
return filePath;
|
||||||
},
|
},
|
||||||
|
|
||||||
accountsPath: (options, id) => {
|
accountsPath: (options, id) => {
|
||||||
var filePath = path.join(options.configDir, options.accountsDir, tameWild(id) + '.json');
|
var filePath = path.join(options.configDir, options.accountsDir, tameWild(id) + ".json");
|
||||||
console.log('filePath:', filePath);
|
console.log("filePath:", filePath);
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
18
test.js
18
test.js
|
@ -1,21 +1,21 @@
|
||||||
console.log('Testing the strategy.');
|
console.log("Testing the challenge.");
|
||||||
|
|
||||||
require('dotenv').config();
|
require("dotenv").config();
|
||||||
|
|
||||||
let accessKeyId = process.env.AWS_ACCESS_KEY_ID
|
let accessKeyId = process.env.AWS_ACCESS_KEY_ID
|
||||||
secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY
|
, secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY
|
||||||
regionName = process.env.AWS_BUCKET_REGION
|
, regionName = process.env.AWS_BUCKET_REGION
|
||||||
bucketName = process.env.AWS_BUCKET_NAME
|
, bucketName = process.env.AWS_BUCKET_NAME
|
||||||
|
|
||||||
let tester = require('greenlock-store-test');
|
let tester = require("greenlock-store-test");
|
||||||
|
|
||||||
let store = require('./index').create({
|
let store = require("./index").create({
|
||||||
accessKeyId: accessKeyId
|
accessKeyId: accessKeyId
|
||||||
, secretAccessKey: secretAccessKey
|
, secretAccessKey: secretAccessKey
|
||||||
, regionName: regionName
|
, regionName: regionName
|
||||||
, bucketName: bucketName
|
, bucketName: bucketName
|
||||||
, configDir: 'acme/'
|
, configDir: "acme/"
|
||||||
, accountsDir: 'accounts/'
|
, accountsDir: "accounts/"
|
||||||
, debug: true
|
, debug: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue