Allowing server to start without iRedMail postgres connection

This commit is contained in:
Chris Troutner
2019-01-21 17:26:27 -08:00
parent c0346f2e32
commit 94bd7811a1
3 changed files with 15 additions and 6 deletions
+9 -5
View File
@@ -54,12 +54,16 @@ async function startServer () {
await app.listen(config.port)
console.log(`Server started on ${config.port}`)
const iRedMail = new IRedMail()
await iRedMail.sequelize.authenticate()
console.log('Connection to the iRedMail postgres database has been established successfully.')
try {
const iRedMail = new IRedMail()
await iRedMail.sequelize.authenticate()
console.log('Connection to the iRedMail postgres database has been established successfully.')
// Attach to iRedMail instantiation to the context object.
app.context.iRedMail = iRedMail
// Attach to iRedMail instantiation to the context object.
app.context.iRedMail = iRedMail
} catch (err) {
console.log(`Could not connect to iRedMail instance.`)
}
return app
}
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
port: process.env.PORT || 5000
}
+3 -1
View File
@@ -2,7 +2,9 @@
let common
try {
common = require('./env/common')
} catch (err) {}
} catch (err) {
common = require('./env/min-config')
}
// Default to development environment.
const env = process.env.NODE_ENV || 'development'