Built motion from commit f7863d46.|2.5.41
[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 _0x434e=['./config/schedule/cloud-provider','sequelize','sync','then','info','start','map','filter','online','name','join','None','./config/seedDB','./config/license','error','exit','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x434e,0xc6));var _0xe434=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x434e[_0x55969b];return _0x3d7fc1;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0xe434('0x0'));var config=require(_0xe434('0x1'));var logger=require(_0xe434('0x2'))(_0xe434('0x3'));var pm2=require(_0xe434('0x4'));var pm2Config=require(_0xe434('0x5'));var schedule=require(_0xe434('0x6'));var chat=require(_0xe434('0x7'));var whatsapp=require(_0xe434('0x8'));var transcribe=require(_0xe434('0x9'));var provider=require(_0xe434('0xa'));function main(){return mysqldb['db'][_0xe434('0xb')][_0xe434('0xc')]()[_0xe434('0xd')](function(){return rpc['listen']();})[_0xe434('0xd')](function(_0x22fba6){logger[_0xe434('0xe')](_0x22fba6);return chat[_0xe434('0xf')]();})[_0xe434('0xd')](function(){return whatsapp[_0xe434('0xf')]();})[_0xe434('0xd')](function(){return schedule[_0xe434('0xf')]();})['then'](function(){return transcribe[_0xe434('0xf')]();})[_0xe434('0xd')](function(){return provider[_0xe434('0xf')]();})[_0xe434('0xd')](function(_0x4d734c){logger[_0xe434('0xe')](_0x4d734c);return pm2['start'](pm2Config);})[_0xe434('0xd')](function(_0x4beabc){logger[_0xe434('0xe')]('Online\x20apps:',_[_0xe434('0x10')](_[_0xe434('0x11')](_0x4beabc,{'status':_0xe434('0x12')}),_0xe434('0x13'))[_0xe434('0x14')]());logger[_0xe434('0xe')]('Offline\x20apps:',_[_0xe434('0x10')](_[_0xe434('0x11')](_0x4beabc,function(_0x4565a6){return _0x4565a6['status']!==_0xe434('0x12');}),_0xe434('0x13'))[_0xe434('0x14')]()||_0xe434('0x15'));config['seedDB']&&require(_0xe434('0x16'))['default']();require(_0xe434('0x17'))['default']();})['catch'](function(_0xb890c9){logger[_0xe434('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xb890c9);process[_0xe434('0x19')](0x1);});}main();