feat: allow defining custom build log transport for techdocs
should enable way to overcome #24583 memory leak, maybe. Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
@@ -38,6 +38,7 @@ import {
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import Docker from 'dockerode';
|
||||
import { createRouter } from '@backstage/plugin-techdocs-backend';
|
||||
import * as winston from 'winston';
|
||||
|
||||
/**
|
||||
* The TechDocs plugin is responsible for serving and building documentation for any entity.
|
||||
@@ -47,6 +48,7 @@ export const techdocsPlugin = createBackendPlugin({
|
||||
pluginId: 'techdocs',
|
||||
register(env) {
|
||||
let docsBuildStrategy: DocsBuildStrategy | undefined;
|
||||
let buildLogTransport: winston.transport | undefined;
|
||||
env.registerExtensionPoint(techdocsBuildsExtensionPoint, {
|
||||
setBuildStrategy(buildStrategy: DocsBuildStrategy) {
|
||||
if (docsBuildStrategy) {
|
||||
@@ -54,6 +56,12 @@ export const techdocsPlugin = createBackendPlugin({
|
||||
}
|
||||
docsBuildStrategy = buildStrategy;
|
||||
},
|
||||
setBuildLogTransport(transport: winston.transport) {
|
||||
if (buildLogTransport) {
|
||||
throw new Error('BuildLogTransport may only be set once');
|
||||
}
|
||||
buildLogTransport = transport;
|
||||
},
|
||||
});
|
||||
|
||||
let customTechdocsGenerator: TechdocsGenerator | undefined;
|
||||
@@ -138,6 +146,7 @@ export const techdocsPlugin = createBackendPlugin({
|
||||
logger: winstonLogger,
|
||||
cache: cacheManager,
|
||||
docsBuildStrategy,
|
||||
buildLogTransport,
|
||||
preparers,
|
||||
generators,
|
||||
publisher,
|
||||
|
||||
Reference in New Issue
Block a user