Allow TechDocs cache in recommended deployment mode.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2021-12-21 12:02:45 +01:00
parent 2d6f65ea2f
commit 8c25c3ea5b
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-backend': patch
---
Fixed a bug preventing cache from being enabled in TechDocs "recommended" deployment mode.
@@ -60,6 +60,7 @@ type RecommendedDeploymentOptions = {
logger: Logger;
discovery: PluginEndpointDiscovery;
config: Config;
cache?: PluginCacheManager;
};
/**
@@ -89,7 +90,7 @@ export async function createRouter(
// Set up a cache client if configured.
let cache: TechDocsCache | undefined;
const defaultTtl = config.getOptionalNumber('techdocs.cache.ttl');
if (isOutOfTheBoxOption(options) && options.cache && defaultTtl) {
if (options.cache && defaultTtl) {
const cacheClient = options.cache.getClient({ defaultTtl });
cache = TechDocsCache.fromConfig(config, { cache: cacheClient, logger });
}