Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { fromRoot } from '../../utils';
import fs from 'fs';
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 @@ -18,6 +20,24 @@ function processCommand(command, options) {
install(settings, logger);
}

function getDefaultConfigPath() {
const paths = [
fromRoot('config/kibana.yml'),
'/etc/kibana/kibana.yml'
];

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

return availablePath || paths[0];
}

export default function pluginInstall(program) {
program
.command('install <plugin/url>')
Expand All @@ -26,7 +46,7 @@ export default function pluginInstall(program) {
.option(
'-c, --config <path>',
'path to the config file',
fromRoot('config/kibana.yml')
getDefaultConfigPath()
)
.option(
'-t, --timeout <duration>',
Expand Down