From 813cbec406ba02db35698ecde1c3ce58f870381e Mon Sep 17 00:00:00 2001 From: hereandnow Date: Thu, 2 Jul 2015 15:56:26 +0200 Subject: [PATCH] let aws-sdk handle the credential handling --- README.md | 11 +++++++++-- tasks/grunt-cloudfront.js | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 34b7038..d286ba3 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,13 @@ grunt.initConfig({ }); ``` +### AWS Region +You can store your AWS region in the following environment variable and it will be used if available: + +```json +AWS_REGION +``` + ### AWS Credentials You should store your AWS credentials outside of source control. They will be loaded from the following environment variables if available: @@ -75,6 +82,6 @@ Or you can store them in a git ignored credential file which looks like this: * May 14, 2013 - __0.1.0__ First release ## License -[Florent Lamoureux](http://twitter.com/flrent) -Licensed under the MIT license. +[Florent Lamoureux](http://twitter.com/flrent) +Licensed under the MIT license. Copyright (c) 2013 - [http://www.payrollhero.com](PayrollHero.com) diff --git a/tasks/grunt-cloudfront.js b/tasks/grunt-cloudfront.js index d26c436..d956f0d 100644 --- a/tasks/grunt-cloudfront.js +++ b/tasks/grunt-cloudfront.js @@ -26,11 +26,13 @@ module.exports = function(grunt) { version = options.version, data = _.omit(this.data, 'options'); + options.credentials = options.credentials || {}; AWS.config.update({ region: options.region, - accessKeyId: (process.env.AWS_ACCESS_KEY_ID || options.credentials.accessKeyId), - secretAccessKey: (process.env.AWS_SECRET_ACCESS_KEY || options.credentials.secretAccessKey), + accessKeyId: options.credentials.accessKeyId, + secretAccessKey: options.credentials.secretAccessKey, }); + var CloudFront = new AWS.CloudFront(); if(!_.isUndefined(version)) {