Skip to content
Browse files

update setDistributionOAI example to new api

  • Loading branch information...
1 parent a6c8cc0 commit 9f6bf388f0304e1764071e03a29b3311d4facffe @tellnes committed May 28, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 examples/setDistributionOAI.js
View
11 examples/setDistributionOAI.js
@@ -5,7 +5,16 @@ var cf = cloudfront.createClient(process.env.AWS_KEY, process.env.AWS_SECRET);
cf.getDistributionConfig(process.argv[2], function(err, config) {
if (err) throw err;
- config.originAccessIdentity = process.argv[3];
+ var id = process.argv[4] || config.defaultCacheBehavior.targetOriginId
+ , origin
+ for (var i = 0, len = config.origins.length; i < len; i++) {
+ if (config.origins[i].id == id) {
+ origin = config.origins[i]
+ break
+ }
+ }
+
+ origin.originAccessIdentity = process.argv[3];
console.log(config);
console.log(cf.generateDistributionXml(config));

0 comments on commit 9f6bf38

Please sign in to comment.
Something went wrong with that request. Please try again.