Built motion from commit f541bb3b.|2.6.14
[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 _0x81bd=['join','Offline\x20apps:','status','None','log','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','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online'];(function(_0x486c22,_0x306c6d){var _0xbad918=function(_0x419503){while(--_0x419503){_0x486c22['push'](_0x486c22['shift']());}};_0xbad918(++_0x306c6d);}(_0x81bd,0x7c));var _0xd81b=function(_0x378fc7,_0x5181a3){_0x378fc7=_0x378fc7-0x0;var _0x44dfec=_0x81bd[_0x378fc7];return _0x44dfec;};'use strict';var _=require(_0xd81b('0x0'));var db=require(_0xd81b('0x1'))['db'];var seedDb=require(_0xd81b('0x2'));var checkLicense=require(_0xd81b('0x3'));var rpc=require(_0xd81b('0x4'));var config=require(_0xd81b('0x5'));var logger=require(_0xd81b('0x6'))('app');var pm2=require(_0xd81b('0x7'));var pm2Config=require(_0xd81b('0x8'));var schedule=require(_0xd81b('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xd81b('0xa'));var transcribe=require(_0xd81b('0xb'));var provider=require(_0xd81b('0xc'));function main(){return db['sequelize']['sync']()[_0xd81b('0xd')](function(){if(config['seedDB']){return seedDb[_0xd81b('0xe')]();}})[_0xd81b('0xd')](function(){return checkLicense[_0xd81b('0xe')]();})[_0xd81b('0xd')](function(){return rpc[_0xd81b('0xf')]();})[_0xd81b('0xd')](function(_0x4391be){logger[_0xd81b('0x10')](_0x4391be);return chat[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(){return whatsapp[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(){return schedule[_0xd81b('0x11')]();})['then'](function(){return transcribe[_0xd81b('0x11')]();})['then'](function(){return provider[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(_0x5f0b6b){logger[_0xd81b('0x10')](_0x5f0b6b);return pm2['start'](pm2Config);})[_0xd81b('0xd')](function(_0x41bf7a){var _0x6c6041=_0x41bf7a[_0xd81b('0x12')](function(_0x128162){return typeof _0x128162['exitCode']===_0xd81b('0x13')&&_0x128162[_0xd81b('0x14')]>=0x0;});if(_0x6c6041['length']>0x0){throw new Error(_0x6c6041[_0xd81b('0x15')]+_0xd81b('0x16')+_[_0xd81b('0x17')](_0x6c6041,function(_0x15e860){return'\x22'+_0x15e860[_0xd81b('0x18')][_0xd81b('0x19')]+'\x22';}));}logger[_0xd81b('0x10')](_0xd81b('0x1a'),_[_0xd81b('0x17')](_[_0xd81b('0x12')](_0x41bf7a,{'status':_0xd81b('0x1b')}),_0xd81b('0x19'))[_0xd81b('0x1c')]());logger[_0xd81b('0x10')](_0xd81b('0x1d'),_[_0xd81b('0x17')](_['filter'](_0x41bf7a,function(_0x4d566e){return _0x4d566e[_0xd81b('0x1e')]!==_0xd81b('0x1b');}),_0xd81b('0x19'))['join']()||_0xd81b('0x1f'));console[_0xd81b('0x20')]('App\x20Ready!');})[_0xd81b('0x21')](function(_0x13d687){console[_0xd81b('0x20')](_0xd81b('0x22'),_0x13d687);logger[_0xd81b('0x23')](_0xd81b('0x24'),_0x13d687);process[_0xd81b('0x25')](0x1);});}main();