|
| 1 | +--- |
| 2 | +description: Connect the B2C DX VS Code Extension to a B2C Commerce instance — credentials, OAuth, telemetry, and the b2c-dx.* settings reference. |
| 3 | +--- |
| 4 | + |
| 5 | +# Configuration |
| 6 | + |
| 7 | +The extension reuses the [B2C CLI](../guide/configuration)'s configuration system, so anything that works with `b2c` works here — `dw.json`, `SFCC_*` environment variables, and active-instance selection. |
| 8 | + |
| 9 | +This page covers: |
| 10 | + |
| 11 | +- [Connecting to a B2C Instance](#connecting-to-a-b2c-instance) — credentials per feature. |
| 12 | +- [Switching the Active Instance](#switching-the-active-instance) — single-workspace, multi-instance. |
| 13 | +- [Settings Reference](#settings-reference) — the `b2c-dx.*` toggles and verbosity controls. |
| 14 | + |
| 15 | +## Connecting to a B2C Instance |
| 16 | + |
| 17 | +The extension needs different credentials depending on which feature you use. **A `dw.json` at your workspace root is the recommended setup** — populate the fields each feature needs, and the extension picks them up automatically. |
| 18 | + |
| 19 | +### Per-feature requirements |
| 20 | + |
| 21 | +A summary by feature: |
| 22 | + |
| 23 | +| Feature | Required `dw.json` fields | |
| 24 | +| ------- | ------------------------- | |
| 25 | +| **Sandbox Realm Explorer** | OAuth (browser login by default; `client-id` + `client-secret` for headless). `Sandbox API User` role with a tenant filter. | |
| 26 | +| **WebDAV Browser** | `hostname`, `username`, `password` (WebDAV access key). OAuth (`client-id` + `client-secret`) also accepted. | |
| 27 | +| **Content Libraries** | Same as WebDAV. Optionally `contentLibrary` (or `libraries`) to seed the tree. | |
| 28 | +| **Cartridge Code Sync** | WebDAV for transfer **and** OCAPI (`client-id` + `client-secret`) for code-version operations. | |
| 29 | +| **SCAPI API Browser** | `client-id`, `client-secret`, `short-code`, `tenant-id`. | |
| 30 | +| **B2C Script Debugger** | WebDAV (for source-mapping). | |
| 31 | +| **Log Tailing** | WebDAV (logs are read from `Logs/`). | |
| 32 | +| **CAP install** | WebDAV; some apps additionally require OAuth client credentials. | |
| 33 | +| **Scaffold**, **Page Designer Assistant** | None — local-only. | |
| 34 | + |
| 35 | +### Example `dw.json` |
| 36 | + |
| 37 | +```jsonc |
| 38 | +{ |
| 39 | + // WebDAV (Code Sync, WebDAV Browser, Content Libraries, Log Tailing, Debugger) |
| 40 | + "hostname": "abcd-001.dx.commercecloud.salesforce.com", |
| 41 | + "username": "your-bm-username", |
| 42 | + "password": "your-webdav-access-key", |
| 43 | + "code-version": "version1", |
| 44 | + |
| 45 | + // OCAPI / OAuth (Sandbox API, Code Versions, CAP) |
| 46 | + "client-id": "...", |
| 47 | + "client-secret": "...", |
| 48 | + |
| 49 | + // SCAPI (API Browser) |
| 50 | + "short-code": "...", |
| 51 | + "tenant-id": "...", |
| 52 | + |
| 53 | + // Optional — content tree seed |
| 54 | + "contentLibrary": "your-library-id" |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +You can also set any of these via `SFCC_*` environment variables (`SFCC_SERVER`, `SFCC_USERNAME`, `SFCC_CLIENT_ID`, `SFCC_TENANT_ID`, etc.). See the [CLI Configuration guide](../guide/configuration) for the complete list and precedence rules, and the [Authentication Setup guide](../guide/authentication) for OAuth scope requirements and Account Manager API client setup. |
| 59 | + |
| 60 | +<!-- TODO(screenshot): replace ./images/settings.svg with ./images/settings.png — Settings UI filtered to b2c-dx --> |
| 61 | + |
| 62 | +## Switching the Active Instance |
| 63 | + |
| 64 | +When `dw.json` defines multiple named instances (the recommended pattern for working across dev / staging / sandbox), click the cloud icon in the status bar to run **B2C DX: Switch Active Instance** — a quick-pick over the configured instances. Selecting a new one updates the underlying `dw.json` active-instance pointer and refreshes every view. |
| 65 | + |
| 66 | +The same pointer is shared with the CLI: switching here is equivalent to running `b2c setup instance set-active <name>`. |
| 67 | + |
| 68 | +## Settings Reference |
| 69 | + |
| 70 | +These VS Code settings live under the `b2c-dx.*` namespace. **You usually don't need to change any of them** — they exist for niche cases like disabling a feature you don't use, or quieting the log channel for a bug report. To browse: **Settings** (Cmd+,) → search for `b2c-dx`. |
| 71 | + |
| 72 | +### Feature toggles |
| 73 | + |
| 74 | +Each feature is enabled by default. Set to `false` to skip its activation entirely (no tree views, no commands, no context-menu entries). Useful for trimming the UI, isolating activation issues, or running in a project where a feature isn't applicable. |
| 75 | + |
| 76 | +| Setting | Default | |
| 77 | +| ------- | ------- | |
| 78 | +| `b2c-dx.features.sandboxExplorer` | `true` | |
| 79 | +| `b2c-dx.features.webdavBrowser` | `true` | |
| 80 | +| `b2c-dx.features.contentLibraries` | `true` | |
| 81 | +| `b2c-dx.features.codeSync` | `true` | |
| 82 | +| `b2c-dx.features.logTailing` | `true` | |
| 83 | +| `b2c-dx.features.scaffold` | `true` | |
| 84 | +| `b2c-dx.features.apiBrowser` | `true` | |
| 85 | +| `b2c-dx.features.cap` | `true` | |
| 86 | + |
| 87 | +The B2C Script Debugger registers regardless of these toggles — it activates only when a `b2c-script` launch configuration is used. |
| 88 | + |
| 89 | +### Verbosity, polling, telemetry |
| 90 | + |
| 91 | +| Setting | Default | Description | |
| 92 | +| ------- | ------- | ----------- | |
| 93 | +| `b2c-dx.logLevel` | `info` | Verbosity for the **B2C DX** output channel. Allowed: `trace`, `debug`, `info`, `warn`, `error`, `silent`. Applied immediately on change. Drop to `debug` or `trace` when filing a bug. | |
| 94 | +| `b2c-dx.sandbox.pollingInterval` | `10` | Seconds between polls while a sandbox is in a transitional state (`creating`, `starting`, `stopping`, `deleting`, `cloning`). Range: 2–300. Polling stops automatically once the realm settles. | |
| 95 | +| `b2c-dx.telemetry.enabled` | `true` | Send anonymous usage telemetry. Honors VS Code's `telemetry.telemetryLevel` — disabling that disables this regardless of this setting. | |
| 96 | + |
| 97 | +### Complete defaults (copy-paste) |
| 98 | + |
| 99 | +```jsonc |
| 100 | +// .vscode/settings.json |
| 101 | +{ |
| 102 | + "b2c-dx.features.sandboxExplorer": true, |
| 103 | + "b2c-dx.features.webdavBrowser": true, |
| 104 | + "b2c-dx.features.contentLibraries": true, |
| 105 | + "b2c-dx.features.codeSync": true, |
| 106 | + "b2c-dx.features.logTailing": true, |
| 107 | + "b2c-dx.features.scaffold": true, |
| 108 | + "b2c-dx.features.apiBrowser": true, |
| 109 | + "b2c-dx.features.cap": true, |
| 110 | + "b2c-dx.logLevel": "info", |
| 111 | + "b2c-dx.sandbox.pollingInterval": 10, |
| 112 | + "b2c-dx.telemetry.enabled": true |
| 113 | +} |
| 114 | +``` |
| 115 | + |
| 116 | +## Next Steps |
| 117 | + |
| 118 | +- [Overview](./) — what the extension can do. |
| 119 | +- [Authentication Setup](../guide/authentication) — Account Manager API clients, WebDAV access keys, OAuth scopes. |
| 120 | +- [CLI Configuration](../guide/configuration) — full `dw.json` reference and precedence rules. |
0 commit comments