Skip to content

Commit

Permalink
Integrate core CLI with repl.
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Jul 20, 2018
1 parent 545e3bb commit 50d876b
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/core/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ import { LoggingConfig } from '../server/logging';
import { MutableLoggerFactory } from '../server/logging/logger_factory';
import { LoggingService } from '../server/logging/logging_service';
import * as args from './args';
import { CLUSTER_MANAGER_PATH, detectInstallationFeatures } from './installation_features';
import {
CLUSTER_MANAGER_PATH,
detectInstallationFeatures,
REPL_PATH,
} from './installation_features';
import { overrideConfigWithArgv } from './override_config_with_argv';
import { createServeCommand } from './serve';

Expand Down Expand Up @@ -130,12 +134,19 @@ export const run = (argv: string[]) => {
}

const KbnServer = require('../../server/kbn_server');
const legacyService = new LegacyService(
env,
loggerFactory,
configService,
new KbnServer(rawConfig.getRaw(), env.legacy)
);
const kbnServer = new KbnServer(rawConfig.getRaw(), env.legacy);
const legacyService = new LegacyService(env, loggerFactory, configService, kbnServer);

if (parsedArgs.repl) {
if (!installationFeatures.isReplModeSupported) {
throw new Error('Kibana REPL mode can only be run in development mode.');
} else if (process.env.kbnWorkerType === 'server') {
// The kbnWorkerType check is necessary to prevent the repl
// from being started multiple times in different processes.
// We only want one REPL.
require(REPL_PATH).startRepl(kbnServer);
}
}

const root = new Root(
configService,
Expand Down

0 comments on commit 50d876b

Please sign in to comment.