Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuellr committed Feb 16, 2020
2 parents c748bd9 + f998174 commit 8b47a7a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions x-pack/plugins/event_log/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Observable } from 'rxjs';
import { first } from 'rxjs/operators';
import {
CoreSetup,
Expand All @@ -12,6 +13,7 @@ import {
Plugin as CorePlugin,
PluginInitializerContext,
ClusterClient,
SharedGlobalConfig,
} from 'src/core/server';

import { IEventLogConfig, IEventLogService, IEventLogger, IEventLogConfig$ } from './types';
Expand All @@ -20,10 +22,8 @@ import { createEsContext, EsContext } from './es';

export type PluginClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'asScoped'>;

// TODO - figure out how to get ${kibana.index} for `.kibana`
const KIBANA_INDEX = '.kibana';

const PROVIDER = 'eventLog';

const ACTIONS = {
starting: 'starting',
stopping: 'stopping',
Expand All @@ -35,21 +35,26 @@ export class Plugin implements CorePlugin<IEventLogService> {
private eventLogService?: IEventLogService;
private esContext?: EsContext;
private eventLogger?: IEventLogger;
private globalConfig$: Observable<SharedGlobalConfig>;

constructor(private readonly context: PluginInitializerContext) {
this.systemLogger = this.context.logger.get();
this.config$ = this.context.config.create<IEventLogConfig>();
this.globalConfig$ = this.context.config.legacy.globalConfig$;
}

async setup(core: CoreSetup): Promise<IEventLogService> {
const globalConfig = await this.globalConfig$.pipe(first()).toPromise();
const kibanaIndex = globalConfig.kibana.index;

this.systemLogger.debug('setting up plugin');

const config = await this.config$.pipe(first()).toPromise();

this.esContext = createEsContext({
logger: this.systemLogger,
// TODO: get index prefix from config.get(kibana.index)
indexNameRoot: KIBANA_INDEX,
indexNameRoot: kibanaIndex,
clusterClient: core.elasticsearch.adminClient,
});

Expand Down

0 comments on commit 8b47a7a

Please sign in to comment.