2
0
mirror of https://github.com/cderche/greenlock-challenge-s3 synced 2025-05-10 15:36:33 +00:00
2019-05-09 12:25:25 +01:00

14 lines
559 B
JavaScript

const path = require("path");
module.exports.set = (opts, options, s3) => {
let challengeKey = path.join(options.directory, opts.challenge.token);
console.log("set", challengeKey);
return s3.putObject({ Key: challengeKey, Body: opts.challenge.keyAuthorization, Bucket: options.bucketName }).promise().then(function (data) {
console.log("Successfully created challenge.");
return null;
}).catch(function (err) {
console.error("There was an error creating your challenge: " + err.message);
throw err;
});
};