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

[@salesforce/b2c-tooling-sdk](../../modules.md) / [safety](../index.md) / loadGlobalSafetyConfig

# Function: loadGlobalSafetyConfig()

> **loadGlobalSafetyConfig**(`configDir?`): [`SafetyConfigFragment`](../interfaces/SafetyConfigFragment.md) \| `undefined`

Defined in: [packages/b2c-tooling-sdk/src/safety/safety-middleware.ts:237](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/safety-middleware.ts#L237)

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`](../interfaces/SafetyConfigFragment.md) \| `undefined`

Validated safety config fragment, or undefined if no file found
