1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x8693=['updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','isArray','apps','findIndex','name','motion2','NODE_PATH','env','then','readJSON'];(function(_0x50a05d,_0x5bc507){var _0x8de3fe=function(_0xd47463){while(--_0xd47463){_0x50a05d['push'](_0x50a05d['shift']());}};_0x8de3fe(++_0x5bc507);}(_0x8693,0x158));var _0x3869=function(_0x42683c,_0xc02448){_0x42683c=_0x42683c-0x0;var _0x39b762=_0x8693[_0x42683c];return _0x39b762;};var fs=require(_0x3869('0x0'));var path=require(_0x3869('0x1'));var config=require('../config/environment');var root=config[_0x3869('0x2')];var APP_JSON_PATH=path[_0x3869('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4c6c3b){let _0x137cfd=![];if(Array[_0x3869('0x4')](_0x4c6c3b[_0x3869('0x5')])){var _0x44b1c9=_0x4c6c3b[_0x3869('0x5')][_0x3869('0x6')](function(_0x1179da){return _0x1179da[_0x3869('0x7')]===_0x3869('0x8');});if(_0x44b1c9>-0x1){var _0x5c3efe=_0x4c6c3b[_0x3869('0x5')][_0x44b1c9];if(typeof _0x5c3efe['env'][_0x3869('0x9')]!=='string'){_0x5c3efe[_0x3869('0xa')][_0x3869('0x9')]=NODEPATH;_0x137cfd=!![];}}return{'appConfig':_0x4c6c3b,'updated':_0x137cfd};}}function updateAppConfig(_0x59f1d9){return fs['pathExists'](APP_JSON_PATH)[_0x3869('0xb')](function(_0x13ba68){if(_0x13ba68){return fs[_0x3869('0xc')](APP_JSON_PATH)[_0x3869('0xb')](function(_0x4212df){var _0x2a224c=setLegacyLibsNodeEnvPath(_0x4212df);if(_0x2a224c[_0x3869('0xd')]){_0x59f1d9['info'](_0x3869('0xe'));return fs[_0x3869('0xf')](APP_JSON_PATH,_0x4212df,{'spaces':0x2});}else{return Promise[_0x3869('0x3')]();}});}else{return Promise[_0x3869('0x3')]();}});}module[_0x3869('0x10')]=updateAppConfig;