Skip to content

@salesforce/b2c-tooling-sdk / safety / loadGlobalSafetyConfig

Function: loadGlobalSafetyConfig() ​

loadGlobalSafetyConfig(configDir?): SafetyConfigFragment | undefined

Defined in: packages/b2c-tooling-sdk/src/safety/safety-middleware.ts:237

Load global safety configuration from a JSON file.

Resolution order:

  1. SFCC_SAFETY_CONFIG env var — explicit path to a safety config file
  2. {configDir}/safety.json — oclif config directory (e.g., ~/.config/b2c/safety.json)

The file has the same shape as the safety object in dw.json:

json
{ "level": "NO_DELETE", "confirm": true, "rules": [...] }

Parameters ​

configDir? ​

string

oclif config directory path (e.g., this.config.configDir)

Returns ​

SafetyConfigFragment | undefined

Validated safety config fragment, or undefined if no file found

Released under the Apache-2.0 License.