config,backend-common: move config subscribe method to the base config interface
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ import { Knex } from 'knex';
|
||||
import { Location as Location_2 } from '@backstage/catalog-model';
|
||||
import { LocationSpec } from '@backstage/catalog-model';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
import { ObservableConfig } from '@backstage/backend-common';
|
||||
import { Organizations } from 'aws-sdk';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
|
||||
@@ -14,10 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
resolvePackagePath,
|
||||
ObservableConfig,
|
||||
} from '@backstage/backend-common';
|
||||
import { resolvePackagePath } from '@backstage/backend-common';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import path from 'path';
|
||||
import { ConfigLocationEntityProvider } from './ConfigLocationEntityProvider';
|
||||
@@ -83,15 +80,12 @@ describe('ConfigLocationEntityProvider', () => {
|
||||
},
|
||||
};
|
||||
|
||||
const mockConfig: ObservableConfig = Object.assign(
|
||||
new ConfigReader(mutableConfigData),
|
||||
{
|
||||
subscribe: (s: () => void) => {
|
||||
subscriber = s;
|
||||
return { unsubscribe: () => {} };
|
||||
},
|
||||
const mockConfig = Object.assign(new ConfigReader(mutableConfigData), {
|
||||
subscribe: (s: () => void) => {
|
||||
subscriber = s;
|
||||
return { unsubscribe: () => {} };
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const mockConnection = {
|
||||
applyMutation: jest.fn(),
|
||||
|
||||
@@ -15,14 +15,13 @@
|
||||
*/
|
||||
|
||||
import { Config } from '@backstage/config';
|
||||
import { ObservableConfig } from '@backstage/backend-common';
|
||||
import path from 'path';
|
||||
import { getEntityLocationRef } from './processing/util';
|
||||
import { EntityProvider, EntityProviderConnection } from './types';
|
||||
import { locationSpecToLocationEntity } from './util';
|
||||
|
||||
export class ConfigLocationEntityProvider implements EntityProvider {
|
||||
constructor(private readonly config: Config | ObservableConfig) {}
|
||||
constructor(private readonly config: Config) {}
|
||||
|
||||
getProviderName(): string {
|
||||
return 'ConfigLocationProvider';
|
||||
@@ -35,7 +34,7 @@ export class ConfigLocationEntityProvider implements EntityProvider {
|
||||
entities,
|
||||
});
|
||||
|
||||
if ('subscribe' in this.config) {
|
||||
if (this.config.subscribe) {
|
||||
let currentKey = JSON.stringify(entities);
|
||||
|
||||
this.config.subscribe(() => {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
ObservableConfig,
|
||||
PluginDatabaseManager,
|
||||
resolvePackagePath,
|
||||
UrlReader,
|
||||
@@ -80,7 +79,7 @@ import { Stitcher } from './stitching/Stitcher';
|
||||
export type CatalogEnvironment = {
|
||||
logger: Logger;
|
||||
database: PluginDatabaseManager;
|
||||
config: Config | ObservableConfig;
|
||||
config: Config;
|
||||
reader: UrlReader;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user