Skip to content

Commit 3a0f209

Browse files
authored
Cumulative set of the preboot stage adjustments (#108514)
1 parent 8deaa57 commit 3a0f209

17 files changed

+83
-19
lines changed

docs/development/core/server/kibana-plugin-core-server.elasticsearchclientconfig.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ export declare type ElasticsearchClientConfig = Pick<ElasticsearchConfig, 'custo
1414
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ClientOptions['requestTimeout'];
1515
ssl?: Partial<ElasticsearchConfig['ssl']>;
1616
keepAlive?: boolean;
17+
caFingerprint?: ClientOptions['caFingerprint'];
1718
};
1819
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) &gt; [getServerInfo](./kibana-plugin-core-server.httpservicepreboot.getserverinfo.md)
4+
5+
## HttpServicePreboot.getServerInfo property
6+
7+
Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running preboot http server.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
getServerInfo: () => HttpServerInfo;
13+
```

docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ httpPreboot.registerRoutes('my-plugin', (router) => {
7373
| Property | Type | Description |
7474
| --- | --- | --- |
7575
| [basePath](./kibana-plugin-core-server.httpservicepreboot.basepath.md) | <code>IBasePath</code> | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md)<!-- -->. |
76+
| [getServerInfo](./kibana-plugin-core-server.httpservicepreboot.getserverinfo.md) | <code>() =&gt; HttpServerInfo</code> | Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running preboot http server. |
7677

7778
## Methods
7879

src/core/server/core_app/core_app.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('CoreApp', () => {
137137
mockResponseFactory
138138
);
139139

140-
expect(mockResponseFactory.renderAnonymousCoreApp).toHaveBeenCalled();
140+
expect(mockResponseFactory.renderCoreApp).toHaveBeenCalled();
141141
});
142142
});
143143

src/core/server/core_app/core_app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class CoreApp {
6464
httpResources: corePreboot.httpResources.createRegistrar(router),
6565
router,
6666
uiPlugins,
67-
onResourceNotFound: (res) => res.renderAnonymousCoreApp(),
67+
onResourceNotFound: (res) => res.renderCoreApp(),
6868
});
6969
});
7070
}

src/core/server/elasticsearch/client/client_config.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ describe('parseClientOptions', () => {
163163
]
164164
`);
165165
});
166+
167+
it('`caFingerprint` option', () => {
168+
const options = parseClientOptions(createConfig({ caFingerprint: 'ab:cd:ef' }), false);
169+
170+
expect(options.caFingerprint).toBe('ab:cd:ef');
171+
});
166172
});
167173

168174
describe('authorization', () => {

src/core/server/elasticsearch/client/client_config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export type ElasticsearchClientConfig = Pick<
3535
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ClientOptions['requestTimeout'];
3636
ssl?: Partial<ElasticsearchConfig['ssl']>;
3737
keepAlive?: boolean;
38+
caFingerprint?: ClientOptions['caFingerprint'];
3839
};
3940

4041
/**
@@ -96,6 +97,10 @@ export function parseClientOptions(
9697
);
9798
}
9899

100+
if (config.caFingerprint != null) {
101+
clientOptions.caFingerprint = config.caFingerprint;
102+
}
103+
99104
return clientOptions;
100105
}
101106

src/core/server/http/http_service.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const createInternalPrebootContractMock = () => {
8888
csp: CspConfig.DEFAULT,
8989
externalUrl: ExternalUrlConfig.DEFAULT,
9090
auth: createAuthMock(),
91+
getServerInfo: jest.fn(),
9192
};
9293
return mock;
9394
};
@@ -98,6 +99,7 @@ const createPrebootContractMock = () => {
9899
const mock: HttpServicePrebootMock = {
99100
registerRoutes: internalMock.registerRoutes,
100101
basePath: createBasePathMock(),
102+
getServerInfo: jest.fn(),
101103
};
102104

103105
return mock;

src/core/server/http/http_service.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ test('returns `preboot` http server contract on preboot', async () => {
379379
auth: Symbol('auth'),
380380
basePath: Symbol('basePath'),
381381
csp: Symbol('csp'),
382+
getServerInfo: jest.fn(),
382383
};
383384

384385
mockHttpServer.mockImplementation(() => ({
@@ -397,6 +398,7 @@ test('returns `preboot` http server contract on preboot', async () => {
397398
registerRouteHandlerContext: expect.any(Function),
398399
registerRoutes: expect.any(Function),
399400
registerStaticDir: expect.any(Function),
401+
getServerInfo: expect.any(Function),
400402
});
401403
});
402404

src/core/server/http/http_service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export class HttpService
128128

129129
prebootSetup.registerRouterAfterListening(router);
130130
},
131+
getServerInfo: prebootSetup.getServerInfo,
131132
};
132133

133134
return this.internalPreboot;

0 commit comments

Comments
 (0)