fix(backend): Load all schemas from monorepo packages

Signed-off-by: Harry Hogg <hhogg@spotify.com>
This commit is contained in:
Harry Hogg
2021-10-18 11:43:22 +01:00
parent 4b92638259
commit f879e8b2b8
2 changed files with 12 additions and 5 deletions
+1
View File
@@ -36,6 +36,7 @@
"@backstage/integration": "^0.6.7",
"@backstage/types": "^0.1.1",
"@google-cloud/storage": "^5.8.0",
"@lerna/project": "^4.0.0",
"@octokit/rest": "^18.5.3",
"@types/cors": "^2.8.6",
"@types/dockerode": "^3.2.1",
+11 -5
View File
@@ -180,14 +180,20 @@ export async function loadBackendConfig(options: {
const args = parseArgs(options.argv);
const configPaths: string[] = [args.config ?? []].flat();
const schema = await loadConfigSchema({
dependencies: ['@backstage/backend-common'],
});
const config = new ObservableConfigProxy(options.logger);
/* eslint-disable-next-line no-restricted-syntax */
const paths = findPaths(__dirname);
// TODO(hhogg): This is fetching _all_ of the packages of the monorepo
// in order to find the secrets for redactions, however we only care about
// the backend ones, we need to find a way to exclude the frontend packages.
const { Project } = require('@lerna/project');
const project = new Project(paths.targetDir);
const packages = await project.getPackages();
const schema = await loadConfigSchema({
dependencies: packages.map((p: any) => p.name),
});
const config = new ObservableConfigProxy(options.logger);
const configs = await loadConfig({
configRoot: paths.targetRoot,
configPaths: configPaths.map(opt => resolvePath(opt)),