Skip to content

Commit

Permalink
#1072 update port control logic to use a ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
David T Rocca committed Jun 8, 2023
1 parent 1e9108a commit d5ab95f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ db.once('open', () => {
// we're connected!
logger.info('Successfully connected to database!')

let port
if (process.env.NODE_ENV === 'test') {
port = process.env.TEST_PORT || config.get('port')
} else {
port = process.env.PORT || config.get('port')
}
// Our testing envrionent sometimes stands up a short lived instance of the app.
// This can cause breaks if there is already and instance running.
// A different port is used when running our testing environment through ci to avoid port collisions.
const port = process.env.NODE_ENV === 'test' ? process.env.TEST_PORT || config.get('port') : process.env.PORT || config.get('port')
app.listen(port, () => logger.info(`Serving on port ${port}`))
})

Expand Down

0 comments on commit d5ab95f

Please sign in to comment.