![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/tools/helper/ |
'use strict'; module.exports = function(file, plugins, config, failOnError) { // eslint-disable-line func-names if (typeof failOnError === 'undefined') { failOnError = true; } const externalPath = config.projectPath + 'dev/tools/frontools/config/' + file; // Check if file exists inside of config directory if (plugins.globby.sync(externalPath).length) { if (file.includes('yml')) { return plugins.yaml.safeLoad(plugins.fs.readFileSync(externalPath)); } else { return JSON.parse(plugins.fs.readFileSync(externalPath)); } } else if (plugins.globby.sync('config/' + file).length) { if (file.includes('yml')) { return plugins.yaml.safeLoad(plugins.fs.readFileSync('config/' + file)); } else { return JSON.parse(plugins.fs.readFileSync('config/' + file)); } } else { if (failOnError) { throw new plugins.util.PluginError({ 'plugin' : 'config', 'message': plugins.errorMessage('You have to create ' + file) }) } return {}; } };