mirror of
https://github.com/Permissionless-Software-Foundation/bch-email-api.git
synced 2026-09-21 16:52:04 -07:00
Allowing server to start without iRedMail postgres connection
This commit is contained in:
@@ -54,12 +54,16 @@ async function startServer () {
|
|||||||
await app.listen(config.port)
|
await app.listen(config.port)
|
||||||
console.log(`Server started on ${config.port}`)
|
console.log(`Server started on ${config.port}`)
|
||||||
|
|
||||||
|
try {
|
||||||
const iRedMail = new IRedMail()
|
const iRedMail = new IRedMail()
|
||||||
await iRedMail.sequelize.authenticate()
|
await iRedMail.sequelize.authenticate()
|
||||||
console.log('Connection to the iRedMail postgres database has been established successfully.')
|
console.log('Connection to the iRedMail postgres database has been established successfully.')
|
||||||
|
|
||||||
// Attach to iRedMail instantiation to the context object.
|
// Attach to iRedMail instantiation to the context object.
|
||||||
app.context.iRedMail = iRedMail
|
app.context.iRedMail = iRedMail
|
||||||
|
} catch (err) {
|
||||||
|
console.log(`Could not connect to iRedMail instance.`)
|
||||||
|
}
|
||||||
|
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
port: process.env.PORT || 5000
|
||||||
|
}
|
||||||
+3
-1
@@ -2,7 +2,9 @@
|
|||||||
let common
|
let common
|
||||||
try {
|
try {
|
||||||
common = require('./env/common')
|
common = require('./env/common')
|
||||||
} catch (err) {}
|
} catch (err) {
|
||||||
|
common = require('./env/min-config')
|
||||||
|
}
|
||||||
|
|
||||||
// Default to development environment.
|
// Default to development environment.
|
||||||
const env = process.env.NODE_ENV || 'development'
|
const env = process.env.NODE_ENV || 'development'
|
||||||
|
|||||||
Reference in New Issue
Block a user