shiftcode / dynamo-easy

DynamoDB client for NodeJS and browser with a fluent api to build requests. We take care of the type mapping between JS and DynamoDB, customizable trough typescript decorators.
https://shiftcode.github.io/dynamo-easy/
MIT License
206 stars 27 forks source link

Allow custom endpoints #237

Closed aintgoin2goa closed 5 years ago

aintgoin2goa commented 5 years ago

In our project we use [https://hub.docker.com/r/amazon/dynamodb-local/](dynamodb local) for testing and development purposes. In order to do this you need to change use the endpoint option when instantiating DynamnoDB like so:

const dynamo = new AWS.DynamoDB({ endpoint: 'my.endpoint' });

Perhaps we could add something to updateDynamoEasyConfig to add options to be passing in to the DynamoDB constructor? It looks like this is only called in a couple of places.

Happy to fork and give it a go if you like. Also, thanks for building this awesome library, it makes querying Dynamo so much more enjoyable than using the AWS SDK!

simonmumenthaler commented 5 years ago

Hi @aintgoin2goa

I think this option does not belong to dynamoEasyConfig. But when instantiating a DynamoStore or a multi-model request like TransactGetRequest you can always provide an instance of AWS.DynamoDB as optional argument.

const dynamo = new AWS.DynamoDB({ endpoint: 'my.endpoint' });
const myModelStore = new DynamoStore(MyModel, dynamo)
const myTransactGet = new TransactGet(dynamo)

hope this helps.

michaelwittwer commented 5 years ago

@aintgoin2goa please add your comment if you need more assistance with this, the above comment should get you in the right direction. Closing for now.