Merge pull request #9 from jrbenito/pass-headers-nt3rp
Pass headers to s3-sync to be able to set metadata in objects
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
var s3 = require('s3');
|
||||
var chalk = require('chalk');
|
||||
var xtend = require('xtend');
|
||||
|
||||
module.exports = function(args) {
|
||||
|
||||
@@ -16,6 +17,8 @@ module.exports = function(args) {
|
||||
var publicDir = this.config.public_dir;
|
||||
var log = this.log;
|
||||
|
||||
var customHeaders = args.headers || {};
|
||||
|
||||
if (!args.bucket || !config.s3Options.accessKeyId || !config.s3Options.secretAccessKey) {
|
||||
var help = '';
|
||||
|
||||
@@ -27,8 +30,9 @@ module.exports = function(args) {
|
||||
help += ' [aws_key]: <aws_key> # Optional, if provided as environment variable\n';
|
||||
help += ' [aws_secret]: <aws_secret> # Optional, if provided as environment variable\n';
|
||||
help += ' [concurrency]: <concurrency>\n';
|
||||
help += ' [region]: <region> # See https://github.com/LearnBoost/knox#region\n\n',
|
||||
help += 'For more help, you can check the docs: ' + chalk.underline('https://github.com/nt3rp/hexo-deployer-s3');
|
||||
help += ' [region]: <region> # See https://github.com/LearnBoost/knox#region\n',
|
||||
help += ' [headers]: <JSON headers> # Optional, see README.md file\n\n';
|
||||
help += 'For more help, you can check the docs: ' + chalk.underline('https://github.com/nt3rp/hexo-deployer-s3');
|
||||
|
||||
console.log(help);
|
||||
return;
|
||||
@@ -37,9 +41,9 @@ module.exports = function(args) {
|
||||
var params = {
|
||||
localDir: publicDir,
|
||||
deleteRemoved: true,
|
||||
s3Params: {
|
||||
s3Params: xtend({
|
||||
Bucket: args.bucket
|
||||
}
|
||||
},customHeaders)
|
||||
}
|
||||
|
||||
var uploader = client.uploadDir(params);
|
||||
|
||||
Reference in New Issue
Block a user