chore: small refactor and some new config.d.ts
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
+18
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user