mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Rename HttpServerInfo.host to hostname (#70792)
* rename host to hostname * update generated doc * adapt tests * fix types
This commit is contained in:
parent
2f905e7d86
commit
e7c54d3684
16 changed files with 19 additions and 32 deletions
|
@ -1,13 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [HttpServerInfo](./kibana-plugin-core-server.httpserverinfo.md) > [host](./kibana-plugin-core-server.httpserverinfo.host.md)
|
||||
|
||||
## HttpServerInfo.host property
|
||||
|
||||
The hostname of the server
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
host: string;
|
||||
```
|
|
@ -15,7 +15,7 @@ export interface HttpServerInfo
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [host](./kibana-plugin-core-server.httpserverinfo.host.md) | <code>string</code> | The hostname of the server |
|
||||
| [hostname](./kibana-plugin-core-server.httpserverinfo.hostname.md) | <code>string</code> | The hostname of the server |
|
||||
| [name](./kibana-plugin-core-server.httpserverinfo.name.md) | <code>string</code> | The name of the Kibana server |
|
||||
| [port](./kibana-plugin-core-server.httpserverinfo.port.md) | <code>number</code> | The port the server is listening on |
|
||||
| [protocol](./kibana-plugin-core-server.httpserverinfo.protocol.md) | <code>'http' | 'https' | 'socket'</code> | The protocol used by the server |
|
||||
|
|
|
@ -1051,7 +1051,7 @@ describe('setup contract', () => {
|
|||
let { getServerInfo } = await server.setup(config);
|
||||
|
||||
expect(getServerInfo()).toEqual({
|
||||
host: '127.0.0.1',
|
||||
hostname: '127.0.0.1',
|
||||
name: 'kibana',
|
||||
port: 10002,
|
||||
protocol: 'http',
|
||||
|
@ -1065,7 +1065,7 @@ describe('setup contract', () => {
|
|||
}));
|
||||
|
||||
expect(getServerInfo()).toEqual({
|
||||
host: 'localhost',
|
||||
hostname: 'localhost',
|
||||
name: 'custom-name',
|
||||
port: 12345,
|
||||
protocol: 'http',
|
||||
|
|
|
@ -128,7 +128,7 @@ export class HttpServer {
|
|||
getAuthHeaders: this.authRequestHeaders.get,
|
||||
getServerInfo: () => ({
|
||||
name: config.name,
|
||||
host: config.host,
|
||||
hostname: config.host,
|
||||
port: config.port,
|
||||
protocol: this.server!.info.protocol,
|
||||
}),
|
||||
|
|
|
@ -104,7 +104,7 @@ const createInternalSetupContractMock = () => {
|
|||
mock.createRouter.mockImplementation(() => mockRouter.create());
|
||||
mock.getAuthHeaders.mockReturnValue({ authorization: 'authorization-header' });
|
||||
mock.getServerInfo.mockReturnValue({
|
||||
host: 'localhost',
|
||||
hostname: 'localhost',
|
||||
name: 'kibana',
|
||||
port: 80,
|
||||
protocol: 'http',
|
||||
|
|
|
@ -311,7 +311,7 @@ export interface HttpServerInfo {
|
|||
/** The name of the Kibana server */
|
||||
name: string;
|
||||
/** The hostname of the server */
|
||||
host: string;
|
||||
hostname: string;
|
||||
/** The port the server is listening on */
|
||||
port: number;
|
||||
/** The protocol used by the server */
|
||||
|
|
|
@ -744,7 +744,7 @@ export type HttpResponsePayload = undefined | string | Record<string, any> | Buf
|
|||
|
||||
// @public (undocumented)
|
||||
export interface HttpServerInfo {
|
||||
host: string;
|
||||
hostname: string;
|
||||
name: string;
|
||||
port: number;
|
||||
protocol: 'http' | 'https' | 'socket';
|
||||
|
|
|
@ -42,7 +42,7 @@ export const registerRoutes = ({
|
|||
(await settingsService.getSettings(soClient)).kibana_url ||
|
||||
url.format({
|
||||
protocol: serverInfo.protocol,
|
||||
hostname: serverInfo.host,
|
||||
hostname: serverInfo.hostname,
|
||||
port: serverInfo.port,
|
||||
pathname: basePath.serverBasePath,
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@ export async function setupIngestManager(
|
|||
const flagsUrl = appContextService.getConfig()?.fleet?.kibana?.host;
|
||||
const defaultUrl = url.format({
|
||||
protocol: serverInfo.protocol,
|
||||
hostname: serverInfo.host,
|
||||
hostname: serverInfo.hostname,
|
||||
port: serverInfo.port,
|
||||
pathname: basePath.serverBasePath,
|
||||
});
|
||||
|
|
|
@ -209,10 +209,10 @@ export class Plugin {
|
|||
uuid: core.uuid.getInstanceUuid(),
|
||||
name: serverInfo.name,
|
||||
index: get(legacyConfig, 'kibana.index'),
|
||||
host: serverInfo.host,
|
||||
host: serverInfo.hostname,
|
||||
locale: i18n.getLocale(),
|
||||
port: serverInfo.port.toString(),
|
||||
transport_address: `${serverInfo.host}:${serverInfo.port}`,
|
||||
transport_address: `${serverInfo.hostname}:${serverInfo.port}`,
|
||||
version: this.initializerContext.env.packageInfo.version,
|
||||
snapshot: snapshotRegex.test(this.initializerContext.env.packageInfo.version),
|
||||
},
|
||||
|
|
|
@ -72,7 +72,7 @@ export const buildConfig = async (
|
|||
},
|
||||
server: {
|
||||
basePath: core.http.basePath.serverBasePath,
|
||||
host: serverInfo.host,
|
||||
host: serverInfo.hostname,
|
||||
name: serverInfo.name,
|
||||
port: serverInfo.port,
|
||||
uuid: core.uuid.getInstanceUuid(),
|
||||
|
|
|
@ -11,7 +11,7 @@ import { createConfig$ } from './create_config';
|
|||
import { ReportingConfigType } from './schema';
|
||||
|
||||
interface KibanaServer {
|
||||
host?: string;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
protocol?: string;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ describe('Reporting server createConfig$', () => {
|
|||
let mockLogger: LevelLogger;
|
||||
|
||||
beforeEach(() => {
|
||||
mockCoreSetup = makeMockCoreSetup({ host: 'kibanaHost', port: 5601, protocol: 'http' });
|
||||
mockCoreSetup = makeMockCoreSetup({ hostname: 'kibanaHost', port: 5601, protocol: 'http' });
|
||||
mockInitContext = makeMockInitContext({
|
||||
kibanaServer: {},
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ export function createConfig$(
|
|||
// kibanaServer.hostname, default to server.host, don't allow "0"
|
||||
let kibanaServerHostname = reportingServer.hostname
|
||||
? reportingServer.hostname
|
||||
: serverInfo.host;
|
||||
: serverInfo.hostname;
|
||||
if (kibanaServerHostname === '0') {
|
||||
logger.warn(
|
||||
i18n.translate('xpack.reporting.serverConfig.invalidServerHostname', {
|
||||
|
|
|
@ -37,7 +37,7 @@ describe('Security Plugin', () => {
|
|||
|
||||
mockCoreSetup = coreMock.createSetup();
|
||||
mockCoreSetup.http.getServerInfo.mockReturnValue({
|
||||
host: 'localhost',
|
||||
hostname: 'localhost',
|
||||
name: 'kibana',
|
||||
port: 80,
|
||||
protocol: 'https',
|
||||
|
|
|
@ -30,9 +30,9 @@ export class IframeEmbeddedPlugin implements Plugin {
|
|||
validate: false,
|
||||
},
|
||||
async (context, request, response) => {
|
||||
const { protocol, port, host } = core.http.getServerInfo();
|
||||
const { protocol, port, hostname } = core.http.getServerInfo();
|
||||
|
||||
const kibanaUrl = Url.format({ protocol, hostname: host, port });
|
||||
const kibanaUrl = Url.format({ protocol, hostname, port });
|
||||
|
||||
return response.renderHtml({
|
||||
body: renderBody(kibanaUrl),
|
||||
|
|
|
@ -18,7 +18,7 @@ export function initRoutes(core: CoreSetup) {
|
|||
async (context, request, response) => {
|
||||
const samlResponse = await getSAMLResponse({
|
||||
inResponseTo: await getSAMLRequestId(request.url.href!),
|
||||
destination: `${serverInfo.protocol}://${serverInfo.host}:${serverInfo.port}/api/security/saml/callback`,
|
||||
destination: `${serverInfo.protocol}://${serverInfo.hostname}:${serverInfo.port}/api/security/saml/callback`,
|
||||
});
|
||||
|
||||
return response.renderHtml({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue