Skip to content

Commit

Permalink
Merge pull request #208 from aaronshaf/fix/default-host
Browse files Browse the repository at this point in the history
fix: switch back default host to undefined
  • Loading branch information
aaronshaf authored Feb 4, 2022
2 parents cdac937 + badc164 commit b8c01f1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/dynamodb-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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)
Expand Down

0 comments on commit b8c01f1

Please sign in to comment.