96f4dece865edfbb1a68552136d1c2d888ab8161
[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 _0xd1f1=['join','None','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','start','info','map','filter','online','name','Offline\x20apps:','status'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x2a3ca4,_0x39a7e8){_0x2a3ca4=_0x2a3ca4-0x0;var _0x374c52=_0xd1f1[_0x2a3ca4];return _0x374c52;};'use strict';var _=require(_0x1d1f('0x0'));var mysqldb=require(_0x1d1f('0x1'));var rpc=require('./rpc');var config=require(_0x1d1f('0x2'));var logger=require(_0x1d1f('0x3'))(_0x1d1f('0x4'));var pm2=require(_0x1d1f('0x5'));var pm2Config=require(_0x1d1f('0x6'));var schedule=require(_0x1d1f('0x7'));var chat=require(_0x1d1f('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1d1f('0x9'));function main(){return mysqldb['db'][_0x1d1f('0xa')][_0x1d1f('0xb')]()[_0x1d1f('0xc')](function(){return rpc[_0x1d1f('0xd')]();})['then'](function(_0x4836b3){logger['info'](_0x4836b3);return chat[_0x1d1f('0xe')]();})[_0x1d1f('0xc')](function(){return whatsapp[_0x1d1f('0xe')]();})[_0x1d1f('0xc')](function(){return schedule['start']();})[_0x1d1f('0xc')](function(){return transcribe[_0x1d1f('0xe')]();})[_0x1d1f('0xc')](function(_0x38cff4){logger[_0x1d1f('0xf')](_0x38cff4);return pm2['start'](pm2Config);})['then'](function(_0xad2d04){logger[_0x1d1f('0xf')]('Online\x20apps:',_[_0x1d1f('0x10')](_[_0x1d1f('0x11')](_0xad2d04,{'status':_0x1d1f('0x12')}),_0x1d1f('0x13'))['join']());logger[_0x1d1f('0xf')](_0x1d1f('0x14'),_[_0x1d1f('0x10')](_[_0x1d1f('0x11')](_0xad2d04,function(_0x465f39){return _0x465f39[_0x1d1f('0x15')]!==_0x1d1f('0x12');}),_0x1d1f('0x13'))[_0x1d1f('0x16')]()||_0x1d1f('0x17'));config[_0x1d1f('0x18')]&&require(_0x1d1f('0x19'))[_0x1d1f('0x1a')]();require(_0x1d1f('0x1b'))['default']();})['catch'](function(_0x498fd0){logger[_0x1d1f('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x498fd0);process[_0x1d1f('0x1d')](0x1);});}main();