1 | #!/usr/bin/env node
|
2 |
|
3 | var argv = require('minimist')(process.argv.slice(2))
|
4 |
|
5 | if (argv.help) {
|
6 |
|
7 | return console.log([
|
8 | '',
|
9 | 'Usage: dynalite [--port <port>] [--path <path>] [options]',
|
10 | '',
|
11 | 'A DynamoDB http server, optionally backed by LevelDB',
|
12 | '',
|
13 | 'Options:',
|
14 | '--help Display this help message and exit',
|
15 | '--port <port> The port to listen on (default: 4567)',
|
16 | '--path <path> The path to use for the LevelDB store (in-memory by default)',
|
17 | '--ssl Enable SSL for the web server (default: false)',
|
18 | '--createTableMs <ms> Amount of time tables stay in CREATING state (default: 500)',
|
19 | '--deleteTableMs <ms> Amount of time tables stay in DELETING state (default: 500)',
|
20 | '--updateTableMs <ms> Amount of time tables stay in UPDATING state (default: 500)',
|
21 | '--maxItemSizeKb <kb> Maximum item size (default: 400)',
|
22 | '',
|
23 | 'Report bugs at github.com/mhart/dynalite/issues',
|
24 | ].join('\n'))
|
25 | }
|
26 |
|
27 |
|
28 | if (process.pid == 1) process.on('SIGINT', process.exit)
|
29 |
|
30 | var server = require('./index.js')(argv).listen(argv.port || 4567, function() {
|
31 | var address = server.address(), protocol = argv.ssl ? 'https' : 'http'
|
32 |
|
33 | console.log('Listening at %s://%s:%s', protocol, address.address, address.port)
|
34 | })
|