You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: support sandbox-api-host and mrtApiKey in config sources (#112)
* fix: support sandbox-api-host in config sources like dw.json
The sandbox-api-host parameter was missing from the config resolution
pipeline - it only worked as a CLI flag or env var. Add it to
DwJsonConfig, NormalizedConfig, mapping, merge, and OdsCommand's
loadConfiguration() so it works from all config sources.
* fix: add sandboxApiHost to PackageJsonSource allowed fields
* docs: update configuration tables with missing fields
Add missing entries to env vars table (SFCC_SHORTCODE, SFCC_TENANT_ID,
SFCC_ACCOUNT_MANAGER_HOST, SFCC_WEBDAV_SERVER, SFCC_SANDBOX_API_HOST,
MRT vars), dw.json fields table (tenant-id, account-manager-host,
sandbox-api-host, MRT fields), and package.json table (sandboxApiHost).
* feat: support mrtApiKey in dw.json config source
Add mrtApiKey to DwJsonConfig interface and dw.json mapping so MRT API
key can be configured in dw.json alongside mrtProject/mrtEnvironment.
* fix: handle undefined resolvedConfig in odsHost getter
Use optional chaining on resolvedConfig in the odsHost getter so it
falls back to DEFAULT_ODS_HOST when resolvedConfig isn't yet populated
(e.g. in unit tests that stub commands without full init).
* feat: normalize config keys to accept both camelCase and kebab-case
Add normalizeConfigKeys() utility that resolves all key variants to
canonical camelCase at load boundaries (loadDwJson, PackageJsonSource).
Users can now use either format in dw.json and package.json b2c config.
* fix: add sandboxApiHost to setup config display and export normalizeConfigKeys
Accept both camelCase and kebab-case for all field names in dw.json and package.json `b2c` config. For example, `clientId` and `client-id` are now equivalent everywhere. Legacy aliases like `server`, `passphrase`, and `selfsigned` continue to work.
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+27-6Lines changed: 27 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,16 +61,25 @@ You can configure the CLI using environment variables:
61
61
|`SFCC_CONFIG`| Path to config file (dw.json format) |
62
62
|`SFCC_INSTANCE`| Instance name from config file |
63
63
|`SFCC_SERVER`| The B2C instance hostname |
64
+
|`SFCC_WEBDAV_SERVER`| Separate hostname for WebDAV (if different from main hostname) |
65
+
|`SFCC_CODE_VERSION`| Code version for deployments |
64
66
|`SFCC_CLIENT_ID`| OAuth client ID |
65
67
|`SFCC_CLIENT_SECRET`| OAuth client secret |
68
+
|`SFCC_OAUTH_SCOPES`| OAuth scopes to request |
69
+
|`SFCC_AUTH_METHODS`| Comma-separated list of allowed auth methods |
70
+
|`SFCC_SHORTCODE`| SCAPI short code |
71
+
|`SFCC_TENANT_ID`| Organization/tenant ID for SCAPI |
72
+
|`SFCC_ACCOUNT_MANAGER_HOST`| Account Manager hostname for OAuth |
66
73
|`SFCC_USERNAME`| Basic auth username |
67
74
|`SFCC_PASSWORD`| Basic auth password |
68
-
|`SFCC_AUTH_METHODS`| Comma-separated list of allowed auth methods |
69
-
|`SFCC_OAUTH_SCOPES`| OAuth scopes to request |
70
-
|`SFCC_CODE_VERSION`| Code version for deployments |
71
75
|`SFCC_CERTIFICATE`| Path to PKCS12 certificate for two-factor auth (mTLS) |
72
76
|`SFCC_CERTIFICATE_PASSPHRASE`| Passphrase for the certificate |
73
77
|`SFCC_SELFSIGNED`| Allow self-signed server certificates |
78
+
|`SFCC_SANDBOX_API_HOST`| ODS (sandbox) API hostname |
79
+
|`SFCC_MRT_API_KEY`| MRT API key |
80
+
|`SFCC_MRT_PROJECT`| MRT project slug |
81
+
|`SFCC_MRT_ENVIRONMENT`| MRT environment name |
82
+
|`SFCC_MRT_CLOUD_ORIGIN`| MRT API origin URL override |
74
83
75
84
## .env File
76
85
@@ -91,6 +100,10 @@ Add `.env` to your `.gitignore` to avoid committing credentials.
91
100
92
101
You can create a `dw.json` file to store instance settings. The CLI searches for this file starting from the current directory and walking up the directory tree.
93
102
103
+
::: tip Flexible Field Names
104
+
Both camelCase and kebab-case are accepted for all field names in `dw.json`. For example, `client-id` and `clientId` are equivalent, as are `code-version` and `codeVersion`. Legacy aliases like `server` (for `hostname`) and `passphrase` (for `certificatePassphrase`) are also still supported.
105
+
:::
106
+
94
107
### Single Instance
95
108
96
109
```json
@@ -144,7 +157,7 @@ If no instance is specified, the config with `"active": true` is used.
144
157
145
158
| Field | Description |
146
159
|-------|-------------|
147
-
|`hostname`| B2C instance hostname |
160
+
|`hostname`| B2C instance hostname. Also accepts `server`.|
148
161
|`webdav-hostname`| Separate hostname for WebDAV (if different from main hostname). Also accepts `webdav-server`, `secureHostname`, or `secure-server`. |
149
162
|`code-version`| Code version for deployments |
150
163
|`client-id`| OAuth client ID |
@@ -153,7 +166,14 @@ If no instance is specified, the config with `"active": true` is used.
153
166
|`password`| Basic auth access key (WebDAV) |
154
167
|`oauth-scopes`| OAuth scopes (array of strings) |
155
168
|`auth-methods`| Authentication methods in priority order (array of strings) |
169
+
|`account-manager-host`| Account Manager hostname for OAuth |
156
170
|`shortCode`| SCAPI short code. Also accepts `short-code` or `scapi-shortcode`. |
171
+
|`tenant-id`| Organization/tenant ID for SCAPI |
172
+
|`sandbox-api-host`| ODS (sandbox) API hostname |
173
+
|`mrtApiKey`| MRT API key |
174
+
|`mrtProject`| MRT project slug |
175
+
|`mrtEnvironment`| MRT environment name |
176
+
|`mrtOrigin`| MRT API origin URL override. Also accepts `cloudOrigin`. |
157
177
|`certificate`| Path to PKCS12 certificate for two-factor auth (mTLS) |
158
178
|`certificate-passphrase`| Passphrase for the certificate. Also accepts `passphrase`. |
159
179
|`self-signed`| Allow self-signed server certificates. Also accepts `selfsigned`. |
@@ -177,7 +197,7 @@ For instances that require client certificate authentication:
177
197
The certificate must be in PKCS12 format (`.p12` or `.pfx`). The `self-signed` option is often needed for staging environments with internal certificates.
178
198
179
199
::: tip MRT Configuration
180
-
Managed Runtime API key is not stored in `dw.json`. It is loaded from `~/.mobify`. You can specify `mrtProject` and `mrtEnvironment` in `dw.json` for project/environment selection.
200
+
MRT API key can also be loaded from `~/.mobify`. See [MRT API Key](#mrt-api-key) below.
181
201
:::
182
202
183
203
For multi-instance configurations, each config object also supports:
@@ -206,7 +226,7 @@ You can store project-level defaults in your `package.json` file under the `b2c`
206
226
207
227
### Allowed Fields
208
228
209
-
Only non-sensitive, project-level fields can be configured in `package.json`:
229
+
Only non-sensitive, project-level fields can be configured in `package.json`. Both camelCase and kebab-case are accepted (e.g., `shortCode` or `short-code`):
210
230
211
231
| Field | Description |
212
232
|-------|-------------|
@@ -215,6 +235,7 @@ Only non-sensitive, project-level fields can be configured in `package.json`:
215
235
|`mrtProject`| MRT project slug |
216
236
|`mrtOrigin`| MRT API origin URL override |
217
237
|`accountManagerHost`| Account Manager hostname for OAuth |
238
+
|`sandboxApiHost`| ODS (sandbox) API hostname |
218
239
219
240
::: warning Security Note
220
241
Sensitive fields like `hostname`, `password`, `clientSecret`, `username`, and `mrtApiKey` are intentionally **not** supported in `package.json`. These should be configured via `dw.json` (which should be in `.gitignore`), environment variables, or secure credential stores.
0 commit comments