mirror of
https://github.com/cderche/greenlock-storage-s3
synced 2025-02-22 06:08:04 +00:00
getPromises()
This commit is contained in:
parent
0f5eebd9cc
commit
8e38a11e46
@ -3,7 +3,7 @@ const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
|
||||
const pathHelper = require("../pathHelper");
|
||||
const fileNames = require("../fileNames");
|
||||
|
||||
const setPaths = (opts, options, id) => {
|
||||
const getPaths = (opts, options, id) => {
|
||||
return [
|
||||
pathHelper.certificatesPath(options, id, fileNames.privkey.pem)
|
||||
, pathHelper.certificatesPath(options, id, fileNames.cert)
|
||||
@ -11,13 +11,8 @@ const setPaths = (opts, options, id) => {
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.check = (opts, options) => {
|
||||
const id = opts.certificate && opts.certificate.id || opts.subject;
|
||||
console.log("certificates.check for", opts.subject);
|
||||
|
||||
const paths = setPaths(opts, options, id);
|
||||
|
||||
var promises = [];
|
||||
const getPromises = (options, paths) => {
|
||||
let promises = [];
|
||||
|
||||
for (let i = 0; i < paths.length; i++) {
|
||||
const key = paths[i];
|
||||
@ -31,6 +26,16 @@ module.exports.check = (opts, options) => {
|
||||
promises.push(promise);
|
||||
}
|
||||
|
||||
return promises;
|
||||
}
|
||||
|
||||
module.exports.check = (opts, options) => {
|
||||
const id = opts.certificate && opts.certificate.id || opts.subject;
|
||||
console.log("certificates.check for", opts.subject);
|
||||
|
||||
const paths = getPaths(opts, options, id);
|
||||
const promises = getPromises(options, paths);
|
||||
|
||||
return Promise.all(promises).then((values) => {
|
||||
return {
|
||||
privkey: values[0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user