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

[@salesforce/b2c-tooling-sdk](../../modules.md) / [cli](../index.md) / ConfigSourcesHook

# Type Alias: ConfigSourcesHook

> **ConfigSourcesHook** = `Hook`\<`"b2c:config-sources"`\>

Defined in: [packages/b2c-tooling-sdk/src/cli/hooks.ts:139](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/cli/hooks.ts#L139)

Hook type for `b2c:config-sources`.

Implement this hook in your oclif plugin to provide custom configuration sources.
The hook is called during command initialization, after CLI flags are parsed
but before configuration is resolved.

## Plugin Registration

Register the hook in your plugin's package.json:

```json
{
  "oclif": {
    "hooks": {
      "b2c:config-sources": "./dist/hooks/config-sources.js"
    }
  }
}
```

## Hook Context

Inside the hook function, you have access to:
- `this.config` - oclif Config object
- `this.debug()`, `this.log()`, `this.warn()`, `this.error()` - logging methods

## Example

```typescript
import type { ConfigSourcesHook } from '@salesforce/b2c-tooling-sdk/cli';

const hook: ConfigSourcesHook = async function(options) {
  this.debug(`Hook called with instance: ${options.instance}`);

  // Load config from a custom source (e.g., secrets manager)
  const source = new VaultConfigSource(options.instance);

  return {
    sources: [source],
    priority: 'before', // Override dw.json with secrets
  };
};

export default hook;
```
