diff --git a/src/index.js b/src/index.js index 4aa530726..48cea8f25 100644 --- a/src/index.js +++ b/src/index.js @@ -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}`)) })