diff --git a/.changeset/many-wolves-own.md b/.changeset/many-wolves-own.md new file mode 100644 index 0000000000..672af86d62 --- /dev/null +++ b/.changeset/many-wolves-own.md @@ -0,0 +1,5 @@ +--- +'@backstage/config-loader': minor +--- + +The include transforms applied during config loading will now only apply to the known keys `$file`, `$env`, and `$include`. Any other key that begins with a `$` will now be passed through as is. diff --git a/packages/config-loader/src/sources/transform/include.ts b/packages/config-loader/src/sources/transform/include.ts index fb2b22ef46..c476b0434f 100644 --- a/packages/config-loader/src/sources/transform/include.ts +++ b/packages/config-loader/src/sources/transform/include.ts @@ -21,6 +21,8 @@ import { isObject } from './utils'; import { TransformFunc, ReadFileFunc } from './types'; import { SubstitutionFunc } from '../types'; +const INCLUDE_KEYS = ['$file', '$env', '$include']; + // Parsers for each type of included file const includeFileParser: { [ext in string]: (content: string) => Promise; @@ -48,7 +50,9 @@ export function createIncludeTransform( } // Check if there's any key that starts with a '$', in that case we treat // this entire object as an include description. - const [includeKey] = Object.keys(input).filter(key => key.startsWith('$')); + const [includeKey] = Object.keys(input).filter(key => + INCLUDE_KEYS.includes(key), + ); if (includeKey) { if (Object.keys(input).length !== 1) { throw new Error(