Skip to content

Commit

Permalink
Always add Manager setup route. Fleet, if enabled (#64859) (#64908)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
John Schulz and elasticmachine committed May 6, 2020
1 parent c3ffaa8 commit 94ad6d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/ingest_manager/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export class IngestManagerPlugin
const config = await this.config$.pipe(first()).toPromise();

// Register routes
registerSetupRoutes(router, config);
registerAgentConfigRoutes(router);
registerDatasourceRoutes(router);
registerOutputRoutes(router);
Expand All @@ -177,7 +178,6 @@ export class IngestManagerPlugin
}

if (config.fleet.enabled) {
registerSetupRoutes(router);
registerAgentRoutes(router);
registerEnrollmentApiKeyRoutes(router);
registerInstallScriptRoutes({
Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/ingest_manager/server/routes/setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import { IRouter } from 'src/core/server';

import { PLUGIN_ID, FLEET_SETUP_API_ROUTES, SETUP_API_ROUTE } from '../../constants';
import { IngestManagerConfigType } from '../../../common';
import {
getFleetStatusHandler,
createFleetSetupHandler,
ingestManagerSetupHandler,
} from './handlers';

export const registerRoutes = (router: IRouter) => {
export const registerRoutes = (router: IRouter, config: IngestManagerConfigType) => {
// Ingest manager setup
router.post(
{
Expand All @@ -24,6 +25,11 @@ export const registerRoutes = (router: IRouter) => {
},
ingestManagerSetupHandler
);

if (!config.fleet.enabled) {
return;
}

// Get Fleet setup
router.get(
{
Expand Down

0 comments on commit 94ad6d6

Please sign in to comment.