Skip to content

Commit

Permalink
Review#1: handle review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Aug 2, 2021
1 parent 7c340eb commit 7258a6e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 57 deletions.
1 change: 0 additions & 1 deletion src/plugins/interactive_setup/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ export type ConfigType = TypeOf<typeof ConfigSchema>;

export const ConfigSchema = schema.object({
enabled: schema.boolean({ defaultValue: false }),
forceSetup: schema.boolean({ defaultValue: false }),
});
8 changes: 3 additions & 5 deletions src/plugins/interactive_setup/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ export class UserSetupPlugin implements PrebootPlugin {
// We shouldn't activate interactive setup mode if we detect that user has already configured
// Elasticsearch connection manually: either if Kibana system user credentials are specified or
// user specified non-default host for the Elasticsearch.
// User can also set `interactiveSetup.forceSetup` config to `true` to force interactive setup mode.
const shouldActiveSetupMode =
this.#getConfig().forceSetup ||
(!core.elasticsearch.config.credentialsSpecified &&
core.elasticsearch.config.hosts.length === 1 &&
core.elasticsearch.config.hosts[0] === 'http://localhost:9200');
!core.elasticsearch.config.credentialsSpecified &&
core.elasticsearch.config.hosts.length === 1 &&
core.elasticsearch.config.hosts[0] === 'http://localhost:9200';
if (!shouldActiveSetupMode) {
this.#logger.debug(
'Interactive setup mode will not be activated since Elasticsearch connection is already configured.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

import { schema } from '@kbn/config-schema';

import type { RouteDefinitionParams } from '../';
import type { RouteDefinitionParams } from './';

/**
* Defines routes to deal with Elasticsearch `enroll_kibana` APIs.
*/
export function defineEnrollRoutes({ router }: RouteDefinitionParams) {
router.post(
{
path: '/internal/interactive_setup/enrollment/enroll',
path: '/internal/interactive_setup/enroll',
validate: {
body: schema.object({ token: schema.string() }),
},
Expand Down
16 changes: 0 additions & 16 deletions src/plugins/interactive_setup/server/routes/enrollment/index.ts

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions src/plugins/interactive_setup/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { IBasePath, IRouter, Logger } from 'src/core/server';

import type { ElasticsearchConnectionStatus } from '../../common';
import type { ConfigType } from '../config';
import { defineEnrollmentRoutes } from './enrollment';
import { defineEnrollRoutes } from './enroll';
import { defineViewRoutes } from './views';

/**
Expand All @@ -25,6 +25,6 @@ export interface RouteDefinitionParams {
}

export function defineRoutes(params: RouteDefinitionParams) {
defineEnrollmentRoutes(params);
defineEnrollRoutes(params);
defineViewRoutes(params);
}

0 comments on commit 7258a6e

Please sign in to comment.