Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

@salesforce/b2c-tooling-sdk / config / mergeConfigsWithProtection

Function: mergeConfigsWithProtection()

mergeConfigsWithProtection(overrides, base, options): MergeConfigResult

Defined in: packages/b2c-tooling-sdk/src/config/mapping.ts:110

Merges configurations with hostname mismatch protection.

Applies the precedence rule: overrides > base. If hostname protection is enabled and the override hostname differs from the base hostname, the entire base config is ignored to prevent credential leakage between different instances.

Parameters

overrides

Partial<NormalizedConfig>

Higher-priority config values (e.g., from CLI flags/env)

base

NormalizedConfig

Lower-priority config values (e.g., from dw.json)

options

MergeConfigOptions = {}

Merge options

Returns

MergeConfigResult

Merged config with warnings

Example

typescript
import { mergeConfigsWithProtection } from '@salesforce/b2c-tooling-sdk/config';

const { config, warnings } = mergeConfigsWithProtection(
  { hostname: 'staging.example.com' },
  { hostname: 'prod.example.com', clientId: 'abc' },
  { hostnameProtection: true }
);
// config = { hostname: 'staging.example.com' }
// warnings = [{ code: 'HOSTNAME_MISMATCH', ... }]

All rights reserved.