Skip to content

Commit

Permalink
update trusted signer examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tellnes committed Apr 26, 2012
1 parent 02f5155 commit da341c6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
22 changes: 22 additions & 0 deletions examples/removeDistributionTrustedSigners.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var util = require('util');
var cloudfront = require('..');

var cf = cloudfront.createClient(process.env.AWS_KEY, process.env.AWS_SECRET);

cf.getDistributionConfig(process.argv[2], function(err, config) {
if (err) throw err;

var remove = process.argv.slice(3);
config.trustedSigners = config.trustedSigners.filter(function(signer) {
return !~remove.indexOf(signer);
});

console.log(util.inspect(config, false, 3, true));
console.log(cf.generateDistributionXml(config));

cf.setDistributionConfig(process.argv[2], config, function(err, distribution) {
if (err) throw err;

console.log(util.inspect(distribution, false, 3, true));
});
});
14 changes: 7 additions & 7 deletions examples/setDistributionTrustedSigners.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
var util = require('util');
var cloudfront = require('..');

var cf = cloudfront.createClient(process.env.AWS_KEY, process.env.AWS_SECRET);

cf.getDistributionConfig(process.argv[2], function(err, config) {
if (err) throw err;

if (!config.trustedSigners) {
config.trustedSigners = [];
}

config.trustedSigners.push(process.argv[3]);
config.trustedSigners.push.apply(config.trustedSigners, process.argv.slice(3));

console.log(config);


console.log(util.inspect(config, false, 3, true));
console.log(cf.generateDistributionXml(config));

cf.setDistributionConfig(process.argv[2], config, function(err, config2) {
cf.setDistributionConfig(process.argv[2], config, function(err, distribution) {
if (err) throw err;

console.log(config2);
console.log(util.inspect(distribution, false, 3, true));
});
});

0 comments on commit da341c6

Please sign in to comment.