Skip to content

Commit 5651234

Browse files
committed
New config opt
1 parent 4d50442 commit 5651234

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed

config/kibana.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
xpack.uptime.indexPattern: alt-heartbeat-*
2+
13
# Kibana is served by a back end server. This setting specifies the port to use.
24
#server.port: 5601
35

x-pack/legacy/plugins/uptime/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { i18n } from '@kbn/i18n';
8+
import { Server } from 'hapi';
89
import { resolve } from 'path';
910
import { PluginInitializerContext } from 'src/core/server';
1011
import { PLUGIN } from './common/constants';
@@ -32,6 +33,13 @@ export const uptime = (kibana: any) =>
3233
url: '/app/uptime#/',
3334
},
3435
home: ['plugins/uptime/register_feature'],
36+
injectDefaultVars(server: Server) {
37+
const config = server.config();
38+
console.log("INJECT INDEX PATTERN", config.get('xpack.uptime.indexPattern'));
39+
return {
40+
uptimeIndexPattern: config.get('uptime.indexPattern')
41+
}
42+
}
3543
},
3644
init(server: KibanaServer) {
3745
const initializerContext = {} as PluginInitializerContext;

x-pack/plugins/uptime/kibana.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "uptime",
3+
"version": "8.0.0",
4+
"server": true
5+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { schema, TypeOf } from '@kbn/config-schema';
8+
import { PluginInitializerContext } from 'src/core/server';
9+
import { UptimePlugin } from './plugin';
10+
11+
export const config = {
12+
schema: schema.object({
13+
enabled: schema.maybe(schema.boolean()),
14+
query: schema.object({
15+
indexName: schema.maybe(schema.string()),
16+
}),
17+
}),
18+
};
19+
20+
export const plugin = (initContext: PluginInitializerContext) => new UptimePlugin(initContext);
21+
22+
export type UptimeConfig = TypeOf<typeof config.schema>;
23+
export { UptimeSetup } from './plugin';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { Plugin, PluginInitializerContext } from 'src/core/server';
8+
9+
export class UptimePlugin implements Plugin<UptimeSetup> {
10+
private readonly initContext: PluginInitializerContext;
11+
12+
constructor(initContext: PluginInitializerContext) {
13+
this.initContext = initContext;
14+
}
15+
16+
public setup() {
17+
console.log("X")
18+
console.log("SET IT UP")
19+
console.log("X")
20+
return {
21+
__legacy: {
22+
config: this.initContext.config,
23+
},
24+
};
25+
}
26+
27+
public start() {}
28+
public stop() {}
29+
}
30+
31+
export interface UptimeSetup {
32+
/** @deprecated */
33+
__legacy: {
34+
config: PluginInitializerContext['config'];
35+
};
36+
}

0 commit comments

Comments
 (0)