Skip to content

Commit c82959e

Browse files
committed
Started using grunt-cloudfront for cache invalidation (closes snowplow#276)
1 parent e82b7c0 commit c82959e

3 files changed

Lines changed: 25 additions & 13 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Ensured all page offsets are integers (#291)
44
Added public method to get duid (#289) (TODO)
55
Added public method to get user fingerprint (#288) (TODO)
66
Added bundle.js to deploy/.gitignore (#281)
7-
Started using grunt-cloudfront for cache invalidation (#276) (TODO)
7+
Started using grunt-cloudfront for cache invalidation (#276)
88
Added ability to disable use of localStorage (#181)
99
Added ability to disable cookies (#140) (TODO)
1010

Gruntfile.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ module.exports = function(grunt) {
171171
grunt.loadNpmTasks('grunt-contrib-concat');
172172
grunt.loadNpmTasks('grunt-yui-compressor');
173173
grunt.loadNpmTasks('grunt-s3');
174-
grunt.loadNpmTasks('grunt-cloudfront-clear');
174+
grunt.loadNpmTasks('grunt-cloudfront');
175175
grunt.loadNpmTasks('grunt-browserify');
176176
grunt.loadNpmTasks('intern');
177177
grunt.loadNpmTasks('grunt-lodash');
@@ -217,18 +217,30 @@ module.exports = function(grunt) {
217217
},
218218
});
219219

220-
grunt.config('cloudfront_clear', {
221-
pinned: {
222-
resourcePaths: ['<%= pkg.pinnedVersion %>/sp.js'],
223-
secret_key: '<%= aws.secret %>',
224-
access_key: '<%= aws.key %>',
225-
dist: '<%= aws.distribution %>'
220+
grunt.config('cloudfront', {
221+
options: {
222+
region: 'eu-east-1',
223+
distributionId: '<%= aws.distribution %>',
224+
listInvalidations: true,
225+
listDistributions: true,
226+
credentials: {
227+
accessKeyId: '<%= aws.key %>',
228+
secretAccessKey: '<%= aws.secret %>'
229+
}
226230
},
227231
not_pinned: {
228-
resourcePaths: ['<%= pkg.version %>/sp.js'],
229-
secret_key: '<%= aws.secret %>',
230-
access_key: '<%= aws.key %>',
231-
dist: '<%= aws.distribution %>'
232+
CallerReference: Date.now().toString(),
233+
Paths: {
234+
Quantity: 1,
235+
Items: ['/<%= pkg.version %>/sp.js']
236+
}
237+
},
238+
pinned: {
239+
CallerReference: Date.now().toString(),
240+
Paths: {
241+
Quantity: 1,
242+
Items: ['/<%= pkg.pinnedVersion %>/sp.js']
243+
}
232244
}
233245
});
234246
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"browserify": "~3.28.1",
88
"grunt": "~0.4.2",
99
"grunt-browserify": "~1.3.0",
10-
"grunt-cloudfront-clear": "0.0.1",
10+
"grunt-cloudfront": "^0.2.0",
1111
"grunt-contrib-concat": "~0.3.0",
1212
"grunt-lodash": "~0.3.0",
1313
"grunt-s3": "~0.2.0-alpha.3",

0 commit comments

Comments
 (0)