Permalink
Browse files

add cname example

  • Loading branch information...
1 parent 278de59 commit 8e1b10acbffc7bef6eef982ca07f83eb37590c8d @tellnes committed Apr 26, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 examples/addCname.js
View
18 examples/addCname.js
@@ -0,0 +1,18 @@
+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;
+
+ config.cname.push.apply(config.cname, process.argv.slice(3));
+
+ console.log(config);
+ console.log(cf.generateDistributionXml(config));
+
+ cf.setDistributionConfig(process.argv[2], config, function(err, config2) {
+ if (err) throw err;
+
+ console.log(config2);
+ });
+});

0 comments on commit 8e1b10a

Please sign in to comment.