Built motion from commit 00bf23f6.|2.6.16
[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 _0x1ffe=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','name','None','log','App\x20Ready!'];(function(_0x76c90b,_0x4f75e8){var _0x5c5030=function(_0x1ff29e){while(--_0x1ff29e){_0x76c90b['push'](_0x76c90b['shift']());}};_0x5c5030(++_0x4f75e8);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x3020c0,_0x5d2ca4){_0x3020c0=_0x3020c0-0x0;var _0x171c01=_0x1ffe[_0x3020c0];return _0x171c01;};'use strict';var _=require(_0xe1ff('0x0'));var db=require(_0xe1ff('0x1'))['db'];var seedDb=require(_0xe1ff('0x2'));var checkLicense=require(_0xe1ff('0x3'));var rpc=require(_0xe1ff('0x4'));var config=require(_0xe1ff('0x5'));var logger=require(_0xe1ff('0x6'))(_0xe1ff('0x7'));var pm2=require(_0xe1ff('0x8'));var pm2Config=require(_0xe1ff('0x9'));var schedule=require(_0xe1ff('0xa'));var chat=require(_0xe1ff('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xe1ff('0xc'));function main(){return db[_0xe1ff('0xd')][_0xe1ff('0xe')]()[_0xe1ff('0xf')](function(){if(config[_0xe1ff('0x10')]){return seedDb[_0xe1ff('0x11')]();}})[_0xe1ff('0xf')](function(){return checkLicense[_0xe1ff('0x11')]();})[_0xe1ff('0xf')](function(){return rpc[_0xe1ff('0x12')]();})[_0xe1ff('0xf')](function(_0x5f51d3){logger[_0xe1ff('0x13')](_0x5f51d3);return chat[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return whatsapp[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return schedule[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return transcribe[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return provider[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(_0x1010ef){logger['info'](_0x1010ef);return pm2[_0xe1ff('0x14')](pm2Config);})[_0xe1ff('0xf')](function(_0x26511f){var _0x486942=_0x26511f[_0xe1ff('0x15')](function(_0x45597a){return typeof _0x45597a['exitCode']==='number'&&_0x45597a['exitCode']>=0x0;});if(_0x486942[_0xe1ff('0x16')]>0x0){throw new Error(_0x486942[_0xe1ff('0x16')]+_0xe1ff('0x17')+_[_0xe1ff('0x18')](_0x486942,function(_0x45c3be){return'\x22'+_0x45c3be[_0xe1ff('0x19')]['name']+'\x22';}));}logger['info'](_0xe1ff('0x1a'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,{'status':_0xe1ff('0x1b')}),'name')[_0xe1ff('0x1c')]());logger[_0xe1ff('0x13')](_0xe1ff('0x1d'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,function(_0x149cd7){return _0x149cd7[_0xe1ff('0x1e')]!==_0xe1ff('0x1b');}),_0xe1ff('0x1f'))[_0xe1ff('0x1c')]()||_0xe1ff('0x20'));console[_0xe1ff('0x21')](_0xe1ff('0x22'));})[_0xe1ff('0x23')](function(_0x37face){console[_0xe1ff('0x21')](_0xe1ff('0x24'),_0x37face);logger[_0xe1ff('0x25')](_0xe1ff('0x26'),_0x37face);process[_0xe1ff('0x27')](0x1);});}main();