51487549c20764d27203fdf182d563d653fbda67
[motion2.git] / server / app.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x3c85=['lodash','./mysqldb','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','start','info','map','filter','online','join','status','name','None','seedDB','./config/seedDB','default','./config/license','catch','error'];(function(_0x5a5e49,_0x516115){var _0x2c7b2b=function(_0x423b46){while(--_0x423b46){_0x5a5e49['push'](_0x5a5e49['shift']());}};_0x2c7b2b(++_0x516115);}(_0x3c85,0x1a0));var _0x53c8=function(_0x2b6c36,_0x5ac22e){_0x2b6c36=_0x2b6c36-0x0;var _0x55d7df=_0x3c85[_0x2b6c36];return _0x55d7df;};'use strict';var _=require(_0x53c8('0x0'));var mysqldb=require(_0x53c8('0x1'));var rpc=require(_0x53c8('0x2'));var config=require(_0x53c8('0x3'));var logger=require('./config/logger')('app');var pm2=require(_0x53c8('0x4'));var pm2Config=require(_0x53c8('0x5'));var schedule=require(_0x53c8('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x53c8('0x7'));var transcribe=require(_0x53c8('0x8'));function main(){return mysqldb['db'][_0x53c8('0x9')]['sync']()['then'](function(){return rpc['listen']();})['then'](function(_0x7d5c2a){logger['info'](_0x7d5c2a);return chat['start']();})[_0x53c8('0xa')](function(){return whatsapp[_0x53c8('0xb')]();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x53c8('0xb')]();})['then'](function(_0x5504d8){logger[_0x53c8('0xc')](_0x5504d8);return pm2[_0x53c8('0xb')](pm2Config);})[_0x53c8('0xa')](function(_0x25d2af){logger[_0x53c8('0xc')]('Online\x20apps:',_[_0x53c8('0xd')](_[_0x53c8('0xe')](_0x25d2af,{'status':_0x53c8('0xf')}),'name')[_0x53c8('0x10')]());logger[_0x53c8('0xc')]('Offline\x20apps:',_[_0x53c8('0xd')](_[_0x53c8('0xe')](_0x25d2af,function(_0x25e32a){return _0x25e32a[_0x53c8('0x11')]!==_0x53c8('0xf');}),_0x53c8('0x12'))[_0x53c8('0x10')]()||_0x53c8('0x13'));config[_0x53c8('0x14')]&&require(_0x53c8('0x15'))[_0x53c8('0x16')]();require(_0x53c8('0x17'))[_0x53c8('0x16')]();})[_0x53c8('0x18')](function(_0x59b253){logger[_0x53c8('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x59b253);process['exit'](0x1);});}main();