Merge pull request #20689 from kuangp/fix/config-loader

fix(configLoader): properly resolve targets into absolute paths
This commit is contained in:
Patrik Oldsberg
2023-10-19 20:45:34 +02:00
committed by GitHub
3 changed files with 16 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/config-loader': patch
---
Correctly resolve config targets into absolute paths
@@ -95,6 +95,14 @@ describe('ConfigSources', () => {
),
).toEqual([{ name: 'FileConfigSource', path: '/config.yaml' }]);
expect(
mergeSources(
ConfigSources.defaultForTargets({
targets: [{ type: 'path', target: 'config.yaml' }],
}),
),
).toEqual([{ name: 'FileConfigSource', path: resolvePath('config.yaml') }]);
const subFunc = async () => undefined;
expect(
mergeSources(
@@ -172,8 +180,8 @@ describe('ConfigSources', () => {
}),
),
).toEqual([
{ name: 'FileConfigSource', path: 'a.yaml' },
{ name: 'FileConfigSource', path: 'b.yaml' },
{ name: 'FileConfigSource', path: resolvePath('a.yaml') },
{ name: 'FileConfigSource', path: resolvePath('b.yaml') },
{ name: 'EnvConfigSource', env: { HOME: '/' } },
]);
});
@@ -161,7 +161,7 @@ export class ConfigSources {
}
return FileConfigSource.create({
watch: options.watch,
path: arg.target,
path: resolvePath(arg.target),
substitutionFunc: options.substitutionFunc,
});
});