Adjust to review by making schedule optional
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Vendored
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { TaskScheduleDefinition } from '@backstage/backend-tasks';
|
||||
import { HumanDuration } from '@backstage/types';
|
||||
import { HumanDuration, JsonObject } from '@backstage/types';
|
||||
|
||||
export interface Config {
|
||||
/** Configuration options for the linguist plugin */
|
||||
@@ -40,7 +40,7 @@ export interface Config {
|
||||
/**
|
||||
* [linguist-js](https://www.npmjs.com/package/linguist-js) options
|
||||
*/
|
||||
linguistJsOptions?: object;
|
||||
linguistJsOptions?: JsonObject;
|
||||
|
||||
/** Options for the tags processor */
|
||||
tagsProcessor?: {
|
||||
|
||||
@@ -19,20 +19,11 @@ import {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
TaskScheduleDefinition,
|
||||
readTaskScheduleDefinitionFromConfig,
|
||||
} from '@backstage/backend-tasks';
|
||||
import { readTaskScheduleDefinitionFromConfig } from '@backstage/backend-tasks';
|
||||
import { HumanDuration } from '@backstage/types';
|
||||
|
||||
import { createRouter } from './service/router';
|
||||
|
||||
const DEFAULT_SCHEDULE: TaskScheduleDefinition = {
|
||||
frequency: { minutes: 2 },
|
||||
timeout: { minutes: 15 },
|
||||
initialDelay: { seconds: 15 },
|
||||
};
|
||||
|
||||
/**
|
||||
* Linguist backend plugin
|
||||
*
|
||||
@@ -62,11 +53,12 @@ export const linguistPlugin = createBackendPlugin({
|
||||
tokenManager,
|
||||
httpRouter,
|
||||
}) {
|
||||
const schedule = config.has('linguist.schedule')
|
||||
? readTaskScheduleDefinitionFromConfig(
|
||||
config.getConfig('linguist.schedule'),
|
||||
)
|
||||
: DEFAULT_SCHEDULE;
|
||||
let schedule;
|
||||
if (config.has('linguist.schedule')) {
|
||||
schedule = readTaskScheduleDefinitionFromConfig(
|
||||
config.getConfig('linguist.schedule'),
|
||||
);
|
||||
}
|
||||
const batchSize = config.getOptionalNumber('linguist.batchSize');
|
||||
const useSourceLocation = config.getBoolean(
|
||||
'linguist.useSourceLocation',
|
||||
|
||||
Reference in New Issue
Block a user