-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce support for the server-side new platform plugins. #25473
Changes from all commits
c381bad
b362c87
02b2802
d7cb1cc
2138d18
90208b6
4fb7a41
9a6a33f
d585e86
7e95d39
da59e08
6a58ce0
89c81a4
fc13a1c
ee383b7
c27e140
a99e111
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import { distinctUntilChanged, first, map } from 'rxjs/operators'; | |
import { Config, ConfigPath, ConfigWithSchema, Env } from '.'; | ||
import { Logger, LoggerFactory } from '../logging'; | ||
|
||
/** @internal */ | ||
export class ConfigService { | ||
private readonly log: Logger; | ||
|
||
|
@@ -107,13 +108,20 @@ export class ConfigService { | |
return true; | ||
} | ||
|
||
public async getUnusedPaths(): Promise<string[]> { | ||
public async getUnusedPaths() { | ||
const config = await this.config$.pipe(first()).toPromise(); | ||
const handledPaths = this.handledPaths.map(pathToString); | ||
|
||
return config.getFlattenedPaths().filter(path => !isPathHandled(path, handledPaths)); | ||
} | ||
|
||
public async getUsedPaths() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: need this for the legacy platform so that it doesn't complain about keys that core knows about (new keys maybe, plugin keys as well). We'll still need to figure out what to do with the new platform plugin config keys that are not used immediately during startup (like in the |
||
const config = await this.config$.pipe(first()).toPromise(); | ||
const handledPaths = this.handledPaths.map(pathToString); | ||
|
||
return config.getFlattenedPaths().filter(path => isPathHandled(path, handledPaths)); | ||
} | ||
|
||
private createConfig<TSchema extends Type<any>, TConfig>( | ||
path: ConfigPath, | ||
config: Record<string, any>, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,18 +29,20 @@ export interface PackageInfo { | |
buildSha: string; | ||
} | ||
|
||
interface EnvironmentMode { | ||
export interface EnvironmentMode { | ||
name: 'development' | 'production'; | ||
dev: boolean; | ||
prod: boolean; | ||
} | ||
|
||
/** @internal */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: I'm adding a bunch of |
||
export interface EnvOptions { | ||
configs: string[]; | ||
cliArgs: CliArgs; | ||
isDevClusterMaster: boolean; | ||
} | ||
|
||
/** @internal */ | ||
export interface CliArgs { | ||
dev: boolean; | ||
envName?: string; | ||
|
@@ -61,10 +63,16 @@ export class Env { | |
return new Env(process.cwd(), options); | ||
} | ||
|
||
/** @internal */ | ||
public readonly configDir: string; | ||
/** @internal */ | ||
public readonly binDir: string; | ||
/** @internal */ | ||
public readonly logDir: string; | ||
/** @internal */ | ||
public readonly staticFilesDir: string; | ||
/** @internal */ | ||
public readonly pluginSearchPaths: ReadonlyArray<string>; | ||
|
||
/** | ||
* Information about Kibana package (version, build number etc.). | ||
|
@@ -78,16 +86,19 @@ export class Env { | |
|
||
/** | ||
* Arguments provided through command line. | ||
* @internal | ||
*/ | ||
public readonly cliArgs: Readonly<CliArgs>; | ||
|
||
/** | ||
* Paths to the configuration files. | ||
* @internal | ||
*/ | ||
public readonly configs: ReadonlyArray<string>; | ||
|
||
/** | ||
* Indicates that this Kibana instance is run as development Node Cluster master. | ||
* @internal | ||
*/ | ||
public readonly isDevClusterMaster: boolean; | ||
|
||
|
@@ -100,6 +111,12 @@ export class Env { | |
this.logDir = resolve(this.homeDir, 'log'); | ||
this.staticFilesDir = resolve(this.homeDir, 'ui'); | ||
|
||
this.pluginSearchPaths = [ | ||
resolve(this.homeDir, 'src', 'plugins'), | ||
resolve(this.homeDir, 'plugins'), | ||
resolve(this.homeDir, '..', 'kibana-extra'), | ||
]; | ||
|
||
this.cliArgs = Object.freeze(options.cliArgs); | ||
this.configs = Object.freeze(options.configs); | ||
this.isDevClusterMaster = options.isDevClusterMaster; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,17 @@ | |
import { Observable, Subscription } from 'rxjs'; | ||
import { first } from 'rxjs/operators'; | ||
|
||
import { CoreService } from '../../types/core_service'; | ||
import { CoreService } from '../../types'; | ||
import { Logger, LoggerFactory } from '../logging'; | ||
import { HttpConfig } from './http_config'; | ||
import { HttpServer, HttpServerInfo } from './http_server'; | ||
import { HttpsRedirectServer } from './https_redirect_server'; | ||
import { Router } from './router'; | ||
|
||
/** @internal */ | ||
export type HttpServiceStartContract = HttpServerInfo; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't really related to this PR, but I wanted to raise the concern while I saw it so we can address it later: I don't like that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, totally agree, there is no doubt that we shouldn't ever expose something like this (Joi, Hapi or any other internals). We make this nasty exception to support compatibility bridge between new and legacy HTTP servers. |
||
|
||
/** @internal */ | ||
export class HttpService implements CoreService<HttpServerInfo> { | ||
private readonly httpServer: HttpServer; | ||
private readonly httpsRedirectServer: HttpsRedirectServer; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: don't be confused,
..
is preserved because I mockpath.resolve
in tests.