Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / utils / update-app-config.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 _0x313e=['isArray','apps','findIndex','motion2','env','NODE_PATH','pathExists','readJSON','updated','info','writeJSON','exports','fs-extra','path','../config/environment','resolve','legacy-libs'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x313e,0x11c));var _0xe313=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0x313e[_0x4cc280];return _0x16ed24;};var fs=require(_0xe313('0x0'));var path=require(_0xe313('0x1'));var config=require(_0xe313('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0xe313('0x3')](root,'server/app.json');var NODEPATH=path[_0xe313('0x3')](root,_0xe313('0x4'));function setLegacyLibsNodeEnvPath(_0x15d72c){let _0x837b3=![];if(Array[_0xe313('0x5')](_0x15d72c[_0xe313('0x6')])){var _0x372e5a=_0x15d72c[_0xe313('0x6')][_0xe313('0x7')](function(_0x3ab5d7){return _0x3ab5d7['name']===_0xe313('0x8');});if(_0x372e5a>-0x1){var _0x50f0a9=_0x15d72c[_0xe313('0x6')][_0x372e5a];if(typeof _0x50f0a9[_0xe313('0x9')]['NODE_PATH']!=='string'){_0x50f0a9[_0xe313('0x9')][_0xe313('0xa')]=NODEPATH;_0x837b3=!![];}}return{'appConfig':_0x15d72c,'updated':_0x837b3};}}function updateAppConfig(_0x15b6fc){return fs[_0xe313('0xb')](APP_JSON_PATH)['then'](function(_0x1dedbf){if(_0x1dedbf){return fs[_0xe313('0xc')](APP_JSON_PATH)['then'](function(_0x377fa1){var _0x9818d1=setLegacyLibsNodeEnvPath(_0x377fa1);if(_0x9818d1[_0xe313('0xd')]){_0x15b6fc[_0xe313('0xe')]('Updating\x20app.json');return fs[_0xe313('0xf')](APP_JSON_PATH,_0x377fa1,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe313('0x3')]();}});}module[_0xe313('0x10')]=updateAppConfig;