Skip to content

Commit

Permalink
[plugin installer] Use find instead of some when looking for path
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed Jun 14, 2016
1 parent 9be15fb commit 3ce2c5f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import install from './install';
import Logger from '../lib/logger';
import pkg from '../../utils/package_json';
import { parse, parseMilliseconds } from './settings';
import { find } from 'lodash';

function processCommand(command, options) {
let settings;
Expand All @@ -25,17 +26,16 @@ function getDefaultConfigPath() {
'/etc/kibana/kibana.yml'
];

let defaultPath = paths[0];
paths.some(configPath => {
const availablePath = find(paths, configPath => {
try {
fs.accessSync(configPath, fs.R_OK);
defaultPath = configPath;
return true;
} catch (e) {
//Check the next path
}
});
return defaultPath;

return availablePath || paths[0];
}

export default function pluginInstall(program) {
Expand Down

0 comments on commit 3ce2c5f

Please sign in to comment.