mirror of
https://github.com/cderche/greenlock-challenge-s3
synced 2025-05-10 15:36:33 +00:00
16 lines
555 B
JavaScript
16 lines
555 B
JavaScript
const path = require("path");
|
|
|
|
module.exports.get = (opts, options, s3) => {
|
|
let challengeKey = path.join(options.directory, opts.challenge.token);
|
|
console.log("get", challengeKey);
|
|
|
|
return s3.getObject({ Key: challengeKey, Bucket: options.bucketName }).promise().then(function (data) {
|
|
console.log("Successfully retrieved challenge." + data.Body.toString());
|
|
return {
|
|
keyAuthorization: data.Body.toString()
|
|
}
|
|
}).catch(function (err) {
|
|
console.error(err.message);
|
|
return null;
|
|
});
|
|
}; |