@salesforce/b2c-tooling-sdk / cli / ConfigSourcesHook
Type Alias: ConfigSourcesHook ​
ConfigSourcesHook =
Hook<"b2c:config-sources">
Defined in: packages/b2c-tooling-sdk/src/cli/hooks.ts:139
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 objectthis.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;