Skip to content

Commit

Permalink
feat(standalone): allow configuring HOSTNAME via env var (#44627)
Browse files Browse the repository at this point in the history
Resolves #44626
  • Loading branch information
balazsorban44 authored Jan 6, 2023
1 parent d1db92c commit af5c069
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1762,14 +1762,15 @@ const server = http.createServer(async (req, res) => {
}
})
const currentPort = parseInt(process.env.PORT, 10) || 3000
const hostname = process.env.HOSTNAME || 'localhost'
server.listen(currentPort, (err) => {
if (err) {
console.error("Failed to start server", err)
process.exit(1)
}
const nextServer = new NextServer({
hostname: 'localhost',
hostname,
port: currentPort,
dir: path.join(__dirname),
dev: false,
Expand Down

0 comments on commit af5c069

Please sign in to comment.