Cumulative set of the preboot stage adjustments (#108514) (#109646)

# Conflicts:
#	src/plugins/interactive_setup/server/elasticsearch_service.test.ts
#	src/plugins/interactive_setup/server/elasticsearch_service.ts
#	src/plugins/interactive_setup/server/routes/enroll.test.ts
#	src/plugins/interactive_setup/server/routes/enroll.ts
This commit is contained in:
Aleh Zasypkin 2021-08-23 17:22:31 +02:00 committed by GitHub
parent 377760f060
commit 6fe650d303
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 42 additions and 2 deletions

View file

@ -14,5 +14,6 @@ export declare type ElasticsearchClientConfig = Pick<ElasticsearchConfig, 'custo
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ClientOptions['requestTimeout'];
ssl?: Partial<ElasticsearchConfig['ssl']>;
keepAlive?: boolean;
caFingerprint?: ClientOptions['caFingerprint'];
};
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[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)
## HttpServicePreboot.getServerInfo property
Provides common [information](./kibana-plugin-core-server.httpserverinfo.md) about the running preboot http server.
<b>Signature:</b>
```typescript
getServerInfo: () => HttpServerInfo;
```

View file

@ -73,6 +73,7 @@ httpPreboot.registerRoutes('my-plugin', (router) => {
| Property | Type | Description |
| --- | --- | --- |
| [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)<!-- -->. |
| [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. |
## Methods

View file

@ -137,7 +137,7 @@ describe('CoreApp', () => {
mockResponseFactory
);
expect(mockResponseFactory.renderAnonymousCoreApp).toHaveBeenCalled();
expect(mockResponseFactory.renderCoreApp).toHaveBeenCalled();
});
});

View file

@ -64,7 +64,7 @@ export class CoreApp {
httpResources: corePreboot.httpResources.createRegistrar(router),
router,
uiPlugins,
onResourceNotFound: (res) => res.renderAnonymousCoreApp(),
onResourceNotFound: (res) => res.renderCoreApp(),
});
});
}

View file

@ -163,6 +163,12 @@ describe('parseClientOptions', () => {
]
`);
});
it('`caFingerprint` option', () => {
const options = parseClientOptions(createConfig({ caFingerprint: 'ab:cd:ef' }), false);
expect(options.caFingerprint).toBe('ab:cd:ef');
});
});
describe('authorization', () => {

View file

@ -35,6 +35,7 @@ export type ElasticsearchClientConfig = Pick<
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ClientOptions['requestTimeout'];
ssl?: Partial<ElasticsearchConfig['ssl']>;
keepAlive?: boolean;
caFingerprint?: ClientOptions['caFingerprint'];
};
/**
@ -96,6 +97,10 @@ export function parseClientOptions(
);
}
if (config.caFingerprint != null) {
clientOptions.caFingerprint = config.caFingerprint;
}
return clientOptions;
}

View file

@ -88,6 +88,7 @@ const createInternalPrebootContractMock = () => {
csp: CspConfig.DEFAULT,
externalUrl: ExternalUrlConfig.DEFAULT,
auth: createAuthMock(),
getServerInfo: jest.fn(),
};
return mock;
};
@ -98,6 +99,7 @@ const createPrebootContractMock = () => {
const mock: HttpServicePrebootMock = {
registerRoutes: internalMock.registerRoutes,
basePath: createBasePathMock(),
getServerInfo: jest.fn(),
};
return mock;

View file

@ -379,6 +379,7 @@ test('returns `preboot` http server contract on preboot', async () => {
auth: Symbol('auth'),
basePath: Symbol('basePath'),
csp: Symbol('csp'),
getServerInfo: jest.fn(),
};
mockHttpServer.mockImplementation(() => ({
@ -397,6 +398,7 @@ test('returns `preboot` http server contract on preboot', async () => {
registerRouteHandlerContext: expect.any(Function),
registerRoutes: expect.any(Function),
registerStaticDir: expect.any(Function),
getServerInfo: expect.any(Function),
});
});

View file

@ -128,6 +128,7 @@ export class HttpService
prebootSetup.registerRouterAfterListening(router);
},
getServerInfo: prebootSetup.getServerInfo,
};
return this.internalPreboot;

View file

@ -142,6 +142,11 @@ export interface HttpServicePreboot {
* See {@link IBasePath}.
*/
basePath: IBasePath;
/**
* Provides common {@link HttpServerInfo | information} about the running preboot http server.
*/
getServerInfo: () => HttpServerInfo;
}
/** @internal */
@ -155,6 +160,7 @@ export interface InternalHttpServicePreboot
| 'registerStaticDir'
| 'registerRouteHandlerContext'
| 'server'
| 'getServerInfo'
> {
registerRoutes(path: string, callback: (router: IRouter) => void): void;
}

View file

@ -115,6 +115,7 @@ export function createPluginPrebootSetupContext(
http: {
registerRoutes: deps.http.registerRoutes,
basePath: deps.http.basePath,
getServerInfo: deps.http.getServerInfo,
},
preboot: {
isSetupOnHold: deps.preboot.isSetupOnHold,

View file

@ -807,6 +807,7 @@ export type ElasticsearchClientConfig = Pick<ElasticsearchConfig, 'customHeaders
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ClientOptions['requestTimeout'];
ssl?: Partial<ElasticsearchConfig['ssl']>;
keepAlive?: boolean;
caFingerprint?: ClientOptions['caFingerprint'];
};
// @public
@ -1003,6 +1004,7 @@ export interface HttpServerInfo {
// @public
export interface HttpServicePreboot {
basePath: IBasePath;
getServerInfo: () => HttpServerInfo;
registerRoutes(path: string, callback: (router: IRouter) => void): void;
}