Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
connect-dynamodb
Advanced tools
connect-dynamodb is a DynamoDB session store backed by the aws-sdk
$ npm install connect-dynamodb
Rational defaults are set but can be overridden in the options object. Credentials and configuration are automatically loaded from environment variables or shared credentials but may optionally be passed through a JSON file or object. The client attribute is necessary for use with DynamoDB Local but can be left out if using DynamoDB with your AWS account. To use DynamoDB TTL, enable it on the table and select the expires
field.
AWSConfigPath
Optional path to a file containing your AWS credentials and configurationAWSConfigJSON
Optional JSON object containing your AWS credentials and configurationclient
Optional AWS DynamoDB object from new AWS.DynamoDB()
AWSRegion
Optional AWS region (defaults to 'us-east-1', ignored if using AWSConfigPath
or AWSConfigJSON
)table
Optional DynamoDB server session table name (defaults to "sessions")hashKey
Optional hash key (defaults to "id")prefix
Optional key prefix (defaults to "sess")reapInterval
Legacy session expiration cleanup in milliseconds. Should instead enable DynamoDB TTL and select the expires
field. BREAKING CHANGE from v1.0.11 to v2.0.0 for reaping sessions with changes to the format of the expires field timestamp.var options = {
// Optional DynamoDB table name, defaults to 'sessions'
table: 'myapp-sessions',
// Optional path to AWS credentials and configuration file
// AWSConfigPath: './path/to/credentials.json',
// Optional JSON object of AWS credentials and configuration
AWSConfigJSON: {
accessKeyId: <YOUR_ACCESS_KEY_ID>,
secretAccessKey: <YOUR_SECRET_ACCESS_KEY>,
region: 'us-east-1'
},
// Optional client for alternate endpoint, such as DynamoDB Local
client: new AWS.DynamoDB({ endpoint: new AWS.Endpoint('http://localhost:8000')}),
// Optional ProvisionedThroughput params, defaults to 5
readCapacityUnits: 25,
writeCapacityUnits: 25
};
With connect
var connect = require('connect');
var DynamoDBStore = require('connect-dynamodb')(connect);
connect()
.use(connect.cookieParser())
.use(connect.session({ store: new DynamoDBStore(options), secret: 'keyboard cat'}));
With express 3
var DynamoDBStore = require('connect-dynamodb')(express);
var app = express(
express.cookieParser(),
express.session({ store: new DynamoDBStore(options), secret: 'keyboard cat'});
);
With express 4
var app = express();
var session = require('express-session');
var DynamoDBStore = require('connect-dynamodb')({session: session});
app.use(session({store: new DynamoDBStore(options), secret: 'keyboard cat'}));
OR
var app = express();
var session = require('express-session');
var DynamoDBStore = require('connect-dynamodb')(session);
app.use(session({store: new DynamoDBStore(options), secret: 'keyboard cat'}));
If you want to run the tests locally and have the AWS environment variables setup you can run the command:
npm test
You can also run it locally by running the following two scripts in separate terminals:
docker run -it --rm \
--name=dynamodb-test \
-p 127.0.0.1:8000:8000 \
deangiberson/aws-dynamodb-local
export AWS_CONFIG_JSON='{"endpoint": "http://127.0.0.1:8000", "region": "us-east-1", "accessKeyId": "accesskey", "secretAccessKey": "secretaccesskey"}'
npm test
connect-dynamodb is licensed under the MIT license.
I made this in my spare time, so if you find it useful you can donate at my BTC address: 35dwLrmKHjCgGXyLzBSd6YaTgoXQA17Aoq
. Thank you very much!
2.0.4 / 2019-11-15
FAQs
DynamoDB session store for Connect
The npm package connect-dynamodb receives a total of 45,164 weekly downloads. As such, connect-dynamodb popularity was classified as popular.
We found that connect-dynamodb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.