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
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+72-1Lines changed: 72 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,78 @@ You can configure authentication using environment variables:
86
86
87
87
## Configuration File
88
88
89
-
You can create a configuration file to store instance settings. See the [CLI Reference](/cli/) for more details on configuration file options.
89
+
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.
90
+
91
+
### Single Instance
92
+
93
+
```json
94
+
{
95
+
"hostname": "your-instance.demandware.net",
96
+
"code-version": "version1",
97
+
"client-id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
98
+
"client-secret": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
99
+
}
100
+
```
101
+
102
+
### Multiple Instances
103
+
104
+
For projects that work with multiple instances, use the `configs` array:
105
+
106
+
```json
107
+
{
108
+
"configs": [
109
+
{
110
+
"name": "dev",
111
+
"active": true,
112
+
"hostname": "dev-instance.demandware.net",
113
+
"code-version": "version1",
114
+
"client-id": "dev-client-id"
115
+
},
116
+
{
117
+
"name": "staging",
118
+
"hostname": "staging-instance.demandware.net",
119
+
"code-version": "version1",
120
+
"client-id": "staging-client-id"
121
+
}
122
+
]
123
+
}
124
+
```
125
+
126
+
Use the `--instance` flag to select a specific configuration:
127
+
128
+
```bash
129
+
b2c code deploy --instance staging
130
+
```
131
+
132
+
If no instance is specified, the config with `"active": true` is used.
133
+
134
+
### Supported Fields
135
+
136
+
| Field | Description |
137
+
|-------|-------------|
138
+
|`hostname`| B2C instance hostname |
139
+
|`webdav-hostname`| Separate hostname for WebDAV (if different) |
140
+
|`code-version`| Code version for deployments |
141
+
|`client-id`| OAuth client ID |
142
+
|`client-secret`| OAuth client secret |
143
+
|`username`| Basic auth username |
144
+
|`password`| Basic auth password/access-key |
145
+
|`scopes`| OAuth scopes (array or comma-separated string) |
146
+
|`auth-methods`| Authentication methods in priority order |
Configuration is resolved with the following precedence (highest to lowest):
153
+
154
+
1.**CLI flags and environment variables** - Explicit values always take priority
155
+
2.**dw.json** - Project configuration file
156
+
3.**~/.mobify** - Home directory file (for MRT API key only)
157
+
158
+
::: warning Hostname Mismatch Protection
159
+
When you explicitly specify a hostname that differs from the `dw.json` hostname, the CLI ignores all other values from `dw.json` and only uses your explicit overrides. This prevents accidentally using credentials from one instance with a different server.
0 commit comments