Built motion from commit (unavailable).|2.4.18
[motion2.git] / server / api / setting / setting.rpc.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 _0x58c0=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d83e7,_0x4d3f1c){var _0x1fd0d7=function(_0x32d05c){while(--_0x32d05c){_0x4d83e7['push'](_0x4d83e7['shift']());}};_0x1fd0d7(++_0x4d3f1c);}(_0x58c0,0x16f));var _0x058c=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x58c0[_0x287a47];return _0x3fb726;};'use strict';var _=require('lodash');var util=require(_0x058c('0x0'));var moment=require('moment');var BPromise=require(_0x058c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x058c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x058c('0x3'));var config=require(_0x058c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x058c('0x5')][_0x058c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x40b574,_0x36b2e9,_0xdf6e19){return new BPromise(function(_0x1ff6b2,_0x4c26bb){return client[_0x058c('0x7')](_0x40b574,_0xdf6e19)[_0x058c('0x8')](function(_0x578a5f){logger[_0x058c('0x9')](_0x058c('0xa'),_0x36b2e9,_0x058c('0xb'));logger[_0x058c('0xc')](_0x058c('0xd'),_0x36b2e9,_0x058c('0xb'),JSON[_0x058c('0xe')](_0x578a5f));if(_0x578a5f['error']){if(_0x578a5f[_0x058c('0xf')][_0x058c('0x10')]===0x1f4){logger[_0x058c('0xf')]('Setting,\x20%s,\x20%s',_0x36b2e9,_0x578a5f[_0x058c('0xf')][_0x058c('0x11')]);return _0x4c26bb(_0x578a5f[_0x058c('0xf')][_0x058c('0x11')]);}logger[_0x058c('0xf')](_0x058c('0xa'),_0x36b2e9,_0x578a5f[_0x058c('0xf')]['message']);return _0x1ff6b2(_0x578a5f[_0x058c('0xf')][_0x058c('0x11')]);}else{logger[_0x058c('0x9')](_0x058c('0xa'),_0x36b2e9,_0x058c('0xb'));_0x1ff6b2(_0x578a5f[_0x058c('0x12')]['message']);}})[_0x058c('0x13')](function(_0x16edf5){logger['error']('Setting,\x20%s,\x20%s',_0x36b2e9,_0x16edf5);_0x4c26bb(_0x16edf5);});});}