server.listen(argv.port, initServer) .on('error', err => { if (err.code === 'EADDRINUSE' || err.code === 'EACCES') { // If port is taken, pick one a free one automatically return server.listen(0, initServer) } return fatalError(err) })
const help = () => { const usage = ` Usage: tessella [options] [uri] where [uri] is tilelive URI to serve and [options] is any of: --port - port to run on (default: ${config.port}) --socket - use Unix socket instead of port --cacheSize - cache size in MB (default: ${config.cacheSize}) --sourceCacheSize - source cache size in # of sources (default: ${ config.sourceCacheSize }) --version - returns running version then exits tessella@${packagejson.version} node@${process.versions.node} `; process.stdout.write(`${usage}\n`); process.exit(0); }
static interpretArguments(argv) { let args = require('minimist')(argv); require("../log/logger").log('info', 'interpretArguments()', JSON.stringify(args)); if (args.autoConnect) { Config.autoConnect = args.autoConnect; } if (args.reconnectTimeout) { Config.reconnectTimeout = args.reconnectTimeout; } if (args.hostname) { Config.hostname = args.hostname; } if (args.port) { Config.port = args.port; } if (args.debug) { Config.debug = args.debug; } }