-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
migrate xsrf / version-check / custom-headers handlers to NP #53684
Changes from 6 commits
159e542
b3da5a9
873c62e
8a0db0d
fc25e4b
a84e4f5
82a6684
94c3341
d6f0df6
d333ee3
ce34c8e
b1286e6
c64cb06
4d88dc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,10 @@ import { Observable, Subscription, combineLatest } from 'rxjs'; | |
import { first, map } from 'rxjs/operators'; | ||
import { Server } from 'hapi'; | ||
|
||
import { LoggerFactory } from '../logging'; | ||
import { CoreService } from '../../types'; | ||
|
||
import { Logger } from '../logging'; | ||
import { Logger, LoggerFactory } from '../logging'; | ||
import { ContextSetup } from '../context'; | ||
import { Env } from '../config'; | ||
import { CoreContext } from '../core_context'; | ||
import { PluginOpaqueId } from '../plugins'; | ||
import { CspConfigType, config as cspConfig } from '../csp'; | ||
|
@@ -43,6 +42,7 @@ import { | |
} from './types'; | ||
|
||
import { RequestHandlerContext } from '../../server'; | ||
import { registerCoreHandlers } from './lifecycle_handlers'; | ||
|
||
interface SetupDeps { | ||
context: ContextSetup; | ||
|
@@ -57,18 +57,20 @@ export class HttpService implements CoreService<InternalHttpServiceSetup, HttpSe | |
|
||
private readonly logger: LoggerFactory; | ||
private readonly log: Logger; | ||
private readonly env: Env; | ||
private notReadyServer?: Server; | ||
private requestHandlerContext?: RequestHandlerContextContainer; | ||
|
||
constructor(private readonly coreContext: CoreContext) { | ||
const { logger, configService, env } = coreContext; | ||
|
||
this.logger = logger; | ||
this.env = env; | ||
this.log = logger.get('http'); | ||
this.config$ = combineLatest( | ||
this.config$ = combineLatest([ | ||
configService.atPath<HttpConfigType>(httpConfig.path), | ||
configService.atPath<CspConfigType>(cspConfig.path) | ||
).pipe(map(([http, csp]) => new HttpConfig(http, csp, env))); | ||
configService.atPath<CspConfigType>(cspConfig.path), | ||
]).pipe(map(([http, csp]) => new HttpConfig(http, csp, env))); | ||
this.httpServer = new HttpServer(logger, 'Kibana'); | ||
this.httpsRedirectServer = new HttpsRedirectServer(logger.get('http', 'redirect', 'server')); | ||
} | ||
|
@@ -92,6 +94,9 @@ export class HttpService implements CoreService<InternalHttpServiceSetup, HttpSe | |
} | ||
|
||
const { registerRouter, ...serverContract } = await this.httpServer.setup(config); | ||
|
||
registerCoreHandlers(serverContract, config, this.env); | ||
|
||
Comment on lines
+97
to
+99
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. I did not add a test that ensure this is properly invoked during the service |
||
const contract: InternalHttpServiceSetup = { | ||
...serverContract, | ||
|
||
|
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.
I kept the same name. It's quite long but I don't really have a better idea. If someone comes with a better name, we could deprecates this one now that deprecations can be handled in NP configs