@@ -3,3 +3,5 @@
|
||||
---
|
||||
|
||||
Lighthouse backend plugin can now use an authenticated catalog backend API.
|
||||
|
||||
- Breaking \* You must now pass the `tokenManager` to the lighthouse `createScheduler`.
|
||||
|
||||
@@ -7,6 +7,7 @@ import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { Config } from '@backstage/config';
|
||||
import { Logger } from 'winston';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CreateLighthouseSchedulerOptions {
|
||||
@@ -18,6 +19,8 @@ export interface CreateLighthouseSchedulerOptions {
|
||||
logger: Logger;
|
||||
// (undocumented)
|
||||
scheduler?: PluginTaskScheduler;
|
||||
// (undocumented)
|
||||
tokenManager: TokenManager;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -32,8 +32,10 @@ export async function loadLighthouseEntities(
|
||||
|
||||
const { token } = await tokenManager.getToken();
|
||||
|
||||
return await catalogClient.getEntities({
|
||||
filter: [filter],
|
||||
token,
|
||||
});
|
||||
return await catalogClient.getEntities(
|
||||
{
|
||||
filter: [filter],
|
||||
},
|
||||
{ token },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Config } from '@backstage/config';
|
||||
import { LighthouseRestApi } from '@backstage/plugin-lighthouse-common';
|
||||
import { stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { LighthouseAuditScheduleImpl } from '../config';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
|
||||
/** @public **/
|
||||
export interface CreateLighthouseSchedulerOptions {
|
||||
@@ -79,10 +80,12 @@ export async function createScheduler(
|
||||
logger.info('Running Lighthouse Audit Task');
|
||||
|
||||
const { token } = await tokenManager.getToken();
|
||||
const websitesWithUrl = await catalogClient.getEntities({
|
||||
filter: [filter],
|
||||
token,
|
||||
});
|
||||
const websitesWithUrl = await catalogClient.getEntities(
|
||||
{
|
||||
filter: [filter],
|
||||
},
|
||||
{ token },
|
||||
);
|
||||
|
||||
let index = 0;
|
||||
for (const entity of websitesWithUrl.items) {
|
||||
|
||||
Reference in New Issue
Block a user