7d98dedef83e148475a3cb0d21e7685dbad55abe
[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 _0xae1a=['./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','name','Offline\x20apps:','online','join','./config/seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp'];(function(_0x3b298c,_0xecc0a){var _0xcead0d=function(_0x108c09){while(--_0x108c09){_0x3b298c['push'](_0x3b298c['shift']());}};_0xcead0d(++_0xecc0a);}(_0xae1a,0x166));var _0xaae1=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xae1a[_0x543084];return _0x306a57;};'use strict';var _=require(_0xaae1('0x0'));var mysqldb=require(_0xaae1('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')('app');var pm2=require(_0xaae1('0x2'));var pm2Config=require(_0xaae1('0x3'));var schedule=require('./config/schedule');var chat=require(_0xaae1('0x4'));var whatsapp=require(_0xaae1('0x5'));var transcribe=require(_0xaae1('0x6'));function main(){return mysqldb['db'][_0xaae1('0x7')][_0xaae1('0x8')]()[_0xaae1('0x9')](function(){return rpc[_0xaae1('0xa')]();})[_0xaae1('0x9')](function(_0x59c7e2){logger[_0xaae1('0xb')](_0x59c7e2);return chat[_0xaae1('0xc')]();})['then'](function(){return whatsapp['start']();})[_0xaae1('0x9')](function(){return schedule[_0xaae1('0xc')]();})[_0xaae1('0x9')](function(){return transcribe[_0xaae1('0xc')]();})[_0xaae1('0x9')](function(_0x57201d){logger[_0xaae1('0xb')](_0x57201d);return pm2[_0xaae1('0xc')](pm2Config);})[_0xaae1('0x9')](function(_0x183832){logger[_0xaae1('0xb')](_0xaae1('0xd'),_[_0xaae1('0xe')](_[_0xaae1('0xf')](_0x183832,{'status':'online'}),_0xaae1('0x10'))['join']());logger['info'](_0xaae1('0x11'),_['map'](_[_0xaae1('0xf')](_0x183832,function(_0x4744e0){return _0x4744e0['status']!==_0xaae1('0x12');}),'name')[_0xaae1('0x13')]()||'None');config['seedDB']&&require(_0xaae1('0x14'))[_0xaae1('0x15')]();require(_0xaae1('0x16'))[_0xaae1('0x15')]();})[_0xaae1('0x17')](function(_0x50fd34){logger[_0xaae1('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x50fd34);process[_0xaae1('0x19')](0x1);});}main();