chore: small refactor and some new config.d.ts

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-12-20 13:50:33 +01:00
parent 8ecf8cb449
commit 5c399429d9
2 changed files with 28 additions and 11 deletions
+18
View File
@@ -22,6 +22,24 @@ export interface Config {
};
backend?: {
/**
* Backend configuration for when request authentication is enabled
*
* @deprecated this will be removed when the backwards compatibility is no longer needed with backend-common
*/
auth?: {
/** Keys shared by all backends for signing and validating backend tokens. */
keys?: {
/**
* Secret for generating tokens. Should be a base64 string, recommended
* length is 24 bytes.
*
* @visibility secret
*/
secret: string;
}[];
};
/**
* The full base URL of the backend, as seen from the browser's point of
* view as it makes calls to the backend.
+10 -11
View File
@@ -153,18 +153,17 @@ export async function collectConfigSchemas(
]);
const tsSchemas = await compileTsSchemas(tsSchemaPaths);
const allSchemas = schemas.concat(tsSchemas);
return schemas
.concat(tsSchemas)
.filter(
({ packageName }, _, original) =>
!(
packageName === '@backstage/backend-common' &&
original.some(
({ packageName: p }) => p === '@backstage/backend-defaults',
)
),
);
const isMissingBackendDefaults = !allSchemas.some(
({ packageName }) => packageName === '@backstage/backend-defaults',
);
// Filter out the backend-common schema unless the backend-defaults schema is missing
return allSchemas.filter(
({ packageName }) =>
packageName !== '@backstage/backend-common' || isMissingBackendDefaults,
);
}
// This handles the support of TypeScript .d.ts config schema declarations.