chilts / awssum

(deprecated: use aws-sdk) Node.js modules for talking to lots of Web Service APIs.
Other
462 stars 57 forks source link

minimize awssum initialization #138

Closed techtribe closed 11 years ago

techtribe commented 11 years ago

Could it be possible to minimize the steps to initialize Awssum? Now you'll need to do:

var awssum = require('awssum');
var amazon = awssum.load('amazon/amazon');
var S3 = awssum.load('amazon/s3').S3;

var s3 = new S3({
   'accessKeyId' : process.env.accessKeyId,
   'secretAccessKey' : process.env.secretAccessKey,
   'region' : amazon.US_EAST_1
});

while every service needs the "extra" step

var amazon = awssum.load('amazon/amazon');

Looking at other node modules and their approaches I think it would be nice to minimize to 2 calls, while the amazon-package (lib+configuration) is always needed with every service. So I propose to make it like:

var awssum = require('awssum');
var S3 = awssum.load('amazon/s3').S3;

var s3 = new S3({
   'accessKeyId' : process.env.accessKeyId,
   'secretAccessKey' : process.env.secretAccessKey,
   'region' : awssum.US_EAST_1
});

with an additional remark that regions are added to the awssum object. Sounds strang but in a way it fits unless you can show me the issues that I cause with this proposed change. ;)

thnx.

:D

chilts commented 11 years ago

Am currently making all plugins allow this:

var amazonS3 = require('awssum-amazon-s3');

var s3 = new amazonS3.S3({
   'accessKeyId' : process.env.accessKeyId,
   'secretAccessKey' : process.env.secretAccessKey,
   'region' : amazonS3.US_EAST_1
});

So that's a bit better. Slowly going through the plugins. S3 has been done, the others are on the way. :)

Thanks for poking me into doing something about this one.

Cheers, Andy