fix(configLoader): properly resolve targets into absolute paths
Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user