diff --git a/app-config.yaml b/app-config.yaml index c0f5767a45..dd72051189 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -212,12 +212,12 @@ catalog: pullRequestBranchName: backstage-integration rules: - allow: - - Component - - API - - Resource - - System - - Domain - - Location + - Component + - API + - Resource + - System + - Domain + - Location processors: ldapOrg: diff --git a/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts b/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts index f4b9f5ea59..6cf8682129 100644 --- a/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts +++ b/plugins/catalog-backend/src/ingestion/CatalogRules.test.ts @@ -225,7 +225,12 @@ describe('DefaultCatalogRulesEnforcer', () => { const enforcer = DefaultCatalogRulesEnforcer.fromConfig( new ConfigReader({ catalog: { - rules: [{ allow: ['Component'], locations: [{ type: 'url', match: 'https://github.com/b/*' }] }], + rules: [ + { + allow: ['Component'], + locations: [{ type: 'url', match: 'https://github.com/b/*' }], + }, + ], }, }), ); diff --git a/plugins/catalog-backend/src/ingestion/CatalogRules.ts b/plugins/catalog-backend/src/ingestion/CatalogRules.ts index 0d013dc78b..66fe3da54e 100644 --- a/plugins/catalog-backend/src/ingestion/CatalogRules.ts +++ b/plugins/catalog-backend/src/ingestion/CatalogRules.ts @@ -93,21 +93,23 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer { const rules = new Array(); if (config.has('catalog.rules')) { - const globalRules = config.getConfigArray('catalog.rules').map(ruleConfig => { - const rule: CatalogRule = { - allow: ruleConfig.getStringArray('allow').map(kind => ({ kind })), - }; + const globalRules = config + .getConfigArray('catalog.rules') + .map(ruleConfig => { + const rule: CatalogRule = { + allow: ruleConfig.getStringArray('allow').map(kind => ({ kind })), + }; - const locConf = ruleConfig.getOptionalConfigArray('locations'); - if (locConf) - rule.locations = locConf.map(locationConfig => ({ - match: locationConfig.getOptionalString('match'), - type: locationConfig.getString('type'), - target: locationConfig.getOptionalString('target') - })) + const locConf = ruleConfig.getOptionalConfigArray('locations'); + if (locConf) + rule.locations = locConf.map(locationConfig => ({ + match: locationConfig.getOptionalString('match'), + type: locationConfig.getString('type'), + target: locationConfig.getOptionalString('target'), + })); - return rule; - }); + return rule; + }); rules.push(...globalRules); } else { rules.push(...DefaultCatalogRulesEnforcer.defaultRules); @@ -135,7 +137,7 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer { return new DefaultCatalogRulesEnforcer(rules); } - constructor(private readonly rules: CatalogRule[]) { } + constructor(private readonly rules: CatalogRule[]) {} /** * Checks whether a specific entity/location combination is allowed @@ -157,7 +159,7 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer { private matchLocation( location: LocationSpec, - matchers?: { target?: string; type: string, match?: string }[], + matchers?: { target?: string; type: string; match?: string }[], ): boolean { if (!matchers) { return true;