Built motion from commit 56b8093a.|2.6.29
[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 _0x0dec=['filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start'];(function(_0x357978,_0x5d2ca9){var _0x3fc094=function(_0x4f4ea3){while(--_0x4f4ea3){_0x357978['push'](_0x357978['shift']());}};_0x3fc094(++_0x5d2ca9);}(_0x0dec,0x11c));var _0xc0de=function(_0xad5776,_0x4dc513){_0xad5776=_0xad5776-0x0;var _0x133b3a=_0x0dec[_0xad5776];return _0x133b3a;};'use strict';var _=require(_0xc0de('0x0'));var db=require(_0xc0de('0x1'))['db'];var seedDb=require(_0xc0de('0x2'));var checkLicense=require(_0xc0de('0x3'));var rpc=require('./rpc');var config=require(_0xc0de('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0xc0de('0x5'));var pm2Config=require(_0xc0de('0x6'));var schedule=require(_0xc0de('0x7'));var chat=require(_0xc0de('0x8'));var whatsapp=require(_0xc0de('0x9'));var transcribe=require(_0xc0de('0xa'));var provider=require(_0xc0de('0xb'));function main(){return db[_0xc0de('0xc')][_0xc0de('0xd')]()[_0xc0de('0xe')](function(){if(config[_0xc0de('0xf')]){return seedDb[_0xc0de('0x10')]();}})[_0xc0de('0xe')](function(){return checkLicense[_0xc0de('0x10')]();})[_0xc0de('0xe')](function(){return rpc[_0xc0de('0x11')]();})[_0xc0de('0xe')](function(_0x285146){logger[_0xc0de('0x12')](_0x285146);return chat[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(){return whatsapp[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(){return schedule[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(){return transcribe['start']();})[_0xc0de('0xe')](function(){return provider[_0xc0de('0x13')]();})[_0xc0de('0xe')](function(_0x258c5a){logger[_0xc0de('0x12')](_0x258c5a);return pm2[_0xc0de('0x13')](pm2Config);})[_0xc0de('0xe')](function(_0x3330e0){var _0x3546f4=_0x3330e0[_0xc0de('0x14')](function(_0x11abc2){return typeof _0x11abc2[_0xc0de('0x15')]==='number'&&_0x11abc2[_0xc0de('0x15')]>=0x0;});if(_0x3546f4[_0xc0de('0x16')]>0x0){throw new Error(_0x3546f4['length']+_0xc0de('0x17')+_[_0xc0de('0x18')](_0x3546f4,function(_0x21db23){return'\x22'+_0x21db23['pm2_env'][_0xc0de('0x19')]+'\x22';}));}logger['info'](_0xc0de('0x1a'),_['map'](_[_0xc0de('0x14')](_0x3330e0,{'status':_0xc0de('0x1b')}),'name')[_0xc0de('0x1c')]());logger[_0xc0de('0x12')](_0xc0de('0x1d'),_[_0xc0de('0x18')](_[_0xc0de('0x14')](_0x3330e0,function(_0x8aee7c){return _0x8aee7c[_0xc0de('0x1e')]!==_0xc0de('0x1b');}),'name')[_0xc0de('0x1c')]()||_0xc0de('0x1f'));console[_0xc0de('0x20')](_0xc0de('0x21'));})[_0xc0de('0x22')](function(_0x4b2c66){console[_0xc0de('0x20')](_0xc0de('0x23'),_0x4b2c66);logger[_0xc0de('0x24')](_0xc0de('0x25'),_0x4b2c66);process['exit'](0x1);});}main();