8d798c8dd6d2d7321d3d8135650e7122b88c9514
[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 _0xbc36=['map','online','join','status','name','None','seedDB','./config/seedDB','./config/license','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','listen','then','start','info'];(function(_0x368741,_0x50dd8b){var _0x463dc5=function(_0x5d4761){while(--_0x5d4761){_0x368741['push'](_0x368741['shift']());}};_0x463dc5(++_0x50dd8b);}(_0xbc36,0x169));var _0x6bc3=function(_0x552097,_0x225983){_0x552097=_0x552097-0x0;var _0x2a98a0=_0xbc36[_0x552097];return _0x2a98a0;};'use strict';var _=require(_0x6bc3('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x6bc3('0x1'));var config=require(_0x6bc3('0x2'));var logger=require(_0x6bc3('0x3'))(_0x6bc3('0x4'));var pm2=require(_0x6bc3('0x5'));var pm2Config=require(_0x6bc3('0x6'));var schedule=require(_0x6bc3('0x7'));var chat=require(_0x6bc3('0x8'));var whatsapp=require(_0x6bc3('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x6bc3('0xa')][_0x6bc3('0xb')]()['then'](function(){return rpc[_0x6bc3('0xc')]();})[_0x6bc3('0xd')](function(_0xf07594){logger['info'](_0xf07594);return chat[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(){return whatsapp[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(){return schedule['start']();})[_0x6bc3('0xd')](function(){return transcribe[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(_0x3269c2){logger[_0x6bc3('0xf')](_0x3269c2);return pm2[_0x6bc3('0xe')](pm2Config);})[_0x6bc3('0xd')](function(_0x58f5ab){logger[_0x6bc3('0xf')]('Online\x20apps:',_[_0x6bc3('0x10')](_['filter'](_0x58f5ab,{'status':_0x6bc3('0x11')}),'name')[_0x6bc3('0x12')]());logger[_0x6bc3('0xf')]('Offline\x20apps:',_[_0x6bc3('0x10')](_['filter'](_0x58f5ab,function(_0x5872e1){return _0x5872e1[_0x6bc3('0x13')]!==_0x6bc3('0x11');}),_0x6bc3('0x14'))[_0x6bc3('0x12')]()||_0x6bc3('0x15'));config[_0x6bc3('0x16')]&&require(_0x6bc3('0x17'))['default']();require(_0x6bc3('0x18'))[_0x6bc3('0x19')]();})['catch'](function(_0x426a16){logger[_0x6bc3('0x1a')](_0x6bc3('0x1b'),_0x426a16);process[_0x6bc3('0x1c')](0x1);});}main();