From badc16438a7cf29e6408632ad5f4ffc3589956a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Thu, 3 Feb 2022 21:23:31 +0100 Subject: [PATCH] fix: switch back default host to undefined --- bin/dynamodb-admin.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/dynamodb-admin.js b/bin/dynamodb-admin.js index 415d3b5..25bb98d 100755 --- a/bin/dynamodb-admin.js +++ b/bin/dynamodb-admin.js @@ -28,8 +28,8 @@ parser.add_argument('-o', '--open', { parser.add_argument('-H', '--host', { type: 'str', - default: 'localhost', - help: 'Host to run on (default: localhost)', + required: false, + help: 'Host to run on (default: undefined)', }) parser.add_argument('-p', '--port', { @@ -45,9 +45,12 @@ const host = process.env.HOST || args.host const port = process.env.PORT || args.port const server = app.listen(port, host) server.on('listening', () => { - const address = server.address() - const url = `http://${address.address}:${address.port}` - console.log(` dynamodb-admin listening on ${url})`) + const { address, port } = server.address() + let url = `http://${address}:${port}` + if (!host && address !== '0.0.0.0') { + url += ` (alternatively http://0.0.0.0:${port})` + } + console.log(` dynamodb-admin listening on ${url}`) if (args.open) { open(url)