I have PC running in Kiosk mode (self-service kiosk). It has weak internet connection, so I use local MongoDB server for all data. But sometimes (ex. daily) I want to send statistics and other stuff to remote database. When I start PC, while internet connection is down, i get following message:
error: A hook (`orm`) failed to load!
error: Error: Failed to connect to MongoDB. Are you sure your configured Mongo instance is running?
Error details: { MongoError: connection 1 to ds241489.mlab.com:41489 timed out
at Function.MongoError.create (/home/nevada/v4/node_modules/mongodb-core/lib/error.js:29:11)
at Socket.<anonymous> (/home/nevada/v4/node_modules/mongodb-core/lib/connection/connection.js:186:20)
...
Then Sails crashes and Browser shows error message to user
connections.js:
mlab: {
adapter: 'sails-mongo',
host: 'ds241489.mlab.com',
port: *****,
user: '******',
password: '************',
database: '******'
}
models/Remote.js:
module.exports = {
connection: 'mlab',
attributes: {
// Some stuff here
}
};
Everything works OK while internet is available, but when PC is offline, server refuses to start. How can I skip automatic connection to (remote) DB and then (try to) connect manually, by request from user?