Skip to content

Commit a35ef22

Browse files
committed
notes on dotenv files
1 parent ddee52e commit a35ef22

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/guide/configuration.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ You can configure the CLI using environment variables:
6969
| `SFCC_OAUTH_SCOPES` | OAuth scopes to request |
7070
| `SFCC_CODE_VERSION` | Code version for deployments |
7171

72+
## .env File
73+
74+
The CLI automatically loads a `.env` file from the current working directory if present. Use the same `SFCC_*` variable names as environment variables.
75+
76+
```bash
77+
# .env
78+
SFCC_SERVER=abcd-123.dx.commercecloud.salesforce.com
79+
SFCC_CLIENT_ID=your-client-id
80+
SFCC_CLIENT_SECRET=your-client-secret
81+
```
82+
83+
::: warning
84+
Add `.env` to your `.gitignore` to avoid committing credentials.
85+
:::
86+
7287
## Configuration File
7388

7489
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.
@@ -189,7 +204,7 @@ Sensitive fields like `hostname`, `password`, `clientSecret`, `username`, and `m
189204

190205
Configuration is resolved with the following precedence (highest to lowest):
191206

192-
1. **CLI flags and environment variables** - Explicit values always take priority
207+
1. **CLI flags and environment variables** - Explicit values always take priority (includes `.env` file)
193208
2. **Plugin sources (high priority)** - Custom sources with `priority: 'before'` (or priority < 0)
194209
3. **dw.json** - Project configuration file (priority 0)
195210
4. **~/.mobify** - Home directory file for MRT API key (priority 0)

0 commit comments

Comments
 (0)