---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [config](../index.md) / ConfigSourceRegistry

# Class: ConfigSourceRegistry

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:57](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L57)

Registry for configuration sources.

The registry collects [ConfigSource](../interfaces/ConfigSource.md) instances and makes them available
to [resolveConfig](../functions/resolveConfig.md), which automatically includes globally registered
sources in every resolution. Sources are sorted by priority alongside
default and explicitly-passed sources.

## Usage Modes

**SDK Mode**: Register sources directly via `register()`:
```typescript
globalConfigSourceRegistry.register(mySource);
```

**CLI Mode**: Sources are collected via the `b2c:config-sources` hook
and registered during command initialization.

## Constructors

### Constructor

> **new ConfigSourceRegistry**(): `ConfigSourceRegistry`

#### Returns

`ConfigSourceRegistry`

## Accessors

### size

#### Get Signature

> **get** **size**(): `number`

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:112](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L112)

Returns the number of registered sources.

##### Returns

`number`

## Methods

### clear()

> **clear**(): `void`

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:105](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L105)

Clears all registered sources.

Primarily useful for testing.

#### Returns

`void`

***

### getSourceNames()

> **getSourceNames**(): `string`[]

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:119](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L119)

Returns the names of all registered sources.

#### Returns

`string`[]

***

### getSources()

> **getSources**(): [`ConfigSource`](../interfaces/ConfigSource.md)[]

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:96](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L96)

Returns all registered sources.

Returns a shallow copy to prevent external mutation of the registry.

#### Returns

[`ConfigSource`](../interfaces/ConfigSource.md)[]

Array of registered config sources

***

### register()

> **register**(`source`): `void`

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:69](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L69)

Registers a config source.

Sources participate in priority sorting alongside default sources
when [resolveConfig](../functions/resolveConfig.md) is called. Set the source's `priority`
property to control ordering (lower number = higher priority).

#### Parameters

##### source

[`ConfigSource`](../interfaces/ConfigSource.md)

The config source to register

#### Returns

`void`

***

### unregister()

> **unregister**(`name`): `boolean`

Defined in: [packages/b2c-tooling-sdk/src/config/config-source-registry.ts:80](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/config/config-source-registry.ts#L80)

Unregisters a config source by name.

#### Parameters

##### name

`string`

The name of the source to remove

#### Returns

`boolean`

true if a source was removed, false if not found
