f1f8fa27b8f1fbf246905e9bf6275d1a8287e71b
[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 _0xb511=['status','None','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','filter','online','name','join'];(function(_0xa4febe,_0x126c23){var _0x2712d8=function(_0x2da8d8){while(--_0x2da8d8){_0xa4febe['push'](_0xa4febe['shift']());}};_0x2712d8(++_0x126c23);}(_0xb511,0x165));var _0x1b51=function(_0x236bd8,_0x336442){_0x236bd8=_0x236bd8-0x0;var _0x48d620=_0xb511[_0x236bd8];return _0x48d620;};'use strict';var _=require(_0x1b51('0x0'));var mysqldb=require(_0x1b51('0x1'));var rpc=require(_0x1b51('0x2'));var config=require('./config/environment');var logger=require(_0x1b51('0x3'))(_0x1b51('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x1b51('0x5'));var schedule=require(_0x1b51('0x6'));var chat=require(_0x1b51('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1b51('0x8'));function main(){return mysqldb['db'][_0x1b51('0x9')]['sync']()[_0x1b51('0xa')](function(){return rpc[_0x1b51('0xb')]();})['then'](function(_0xfa46a3){logger[_0x1b51('0xc')](_0xfa46a3);return chat[_0x1b51('0xd')]();})[_0x1b51('0xa')](function(){return whatsapp[_0x1b51('0xd')]();})[_0x1b51('0xa')](function(){return schedule[_0x1b51('0xd')]();})[_0x1b51('0xa')](function(){return transcribe['start']();})[_0x1b51('0xa')](function(_0x3113c9){logger[_0x1b51('0xc')](_0x3113c9);return pm2[_0x1b51('0xd')](pm2Config);})[_0x1b51('0xa')](function(_0x1ed8ad){logger['info'](_0x1b51('0xe'),_[_0x1b51('0xf')](_[_0x1b51('0x10')](_0x1ed8ad,{'status':_0x1b51('0x11')}),_0x1b51('0x12'))[_0x1b51('0x13')]());logger[_0x1b51('0xc')]('Offline\x20apps:',_[_0x1b51('0xf')](_['filter'](_0x1ed8ad,function(_0x5db91e){return _0x5db91e[_0x1b51('0x14')]!==_0x1b51('0x11');}),'name')[_0x1b51('0x13')]()||_0x1b51('0x15'));config[_0x1b51('0x16')]&&require('./config/seedDB')[_0x1b51('0x17')]();require(_0x1b51('0x18'))[_0x1b51('0x17')]();})[_0x1b51('0x19')](function(_0x5deebf){logger[_0x1b51('0x1a')](_0x1b51('0x1b'),_0x5deebf);process[_0x1b51('0x1c')](0x1);});}main();