2
0
mirror of https://github.com/cderche/greenlock-challenge-s3 synced 2025-05-10 15:36:33 +00:00
2019-05-08 17:50:45 +01:00

14 lines
523 B
JavaScript

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;
});
}