Skip to content

Commit cd53dc2

Browse files
committed
Fixing formatting. Clarifying wording.
1 parent 6a3b01d commit cd53dc2

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

src/content/docs/d1/configuration/environments.mdx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ In the code above, the `staging` environment is using a different database (`DAT
2828

2929
## Anatomy of `wrangler.toml` file
3030

31-
If you have multiple environments in your D1 binding, your `wrangler.toml` may look like the following:
31+
If you need to specify different D1 databases for different environments, your `wrangler.toml` may look like the following:
3232

3333
```toml
3434
[[production.d1_databases]]
35-
binding = "DB"
36-
database_name = "DATABASE_NAME"
37-
database_id = "DATABASE_ID"
35+
binding = "DB"
36+
database_name = "DATABASE_NAME"
37+
database_id = "DATABASE_ID"
3838
```
3939

4040
In the above configuration:
4141

42-
- `[[production.d1_databases]]` creates an object `production` with a property `d1_databases` (which is an object itself).
43-
- Any property below the line in the form `<key> = <value>` is a property of the `d1_databases` object.
42+
- `[[production.d1_databases]]` creates an object `production` with a property `d1_databases`, where `d1_databases` is an array of objects.
43+
- Any property below the line in the form `<key> = <value>` is a property of an object within the `d1_databases` array.
4444

4545
Therefore, the above binding is equivalent to:
4646

@@ -62,14 +62,14 @@ Therefore, the above binding is equivalent to:
6262

6363
```toml
6464
[[env.staging.d1_databases]]
65-
binding = "BINDING_NAME_1"
66-
database_name = "DATABASE_NAME_1"
67-
database_id = "UUID_1"
65+
binding = "BINDING_NAME_1"
66+
database_name = "DATABASE_NAME_1"
67+
database_id = "UUID_1"
6868

6969
[[env.production.d1_databases]]
70-
binding = "BINDING_NAME_2"
71-
database_name = "DATABASE_NAME_2"
72-
database_id = "UUID_2"
70+
binding = "BINDING_NAME_2"
71+
database_name = "DATABASE_NAME_2"
72+
database_id = "UUID_2"
7373

7474
```
7575

@@ -78,25 +78,24 @@ The above is equivalent to the following structure in JSON:
7878
```json
7979
{
8080
"env": {
81+
"production": {
82+
"d1_databases": [
83+
{
84+
"binding": "BINDING_NAME_2",
85+
"database_id": "UUID_2",
86+
"database_name": "DATABASE_NAME_2"
87+
}
88+
]
89+
},
8190
"staging": {
8291
"d1_databases": [
8392
{
8493
"binding": "BINDING_NAME_1",
85-
"database_id": "PRODUCTION_DATABASE_1",
86-
"database_name": "UUID_1"
94+
"database_id": "UUID_1",
95+
"database_name": "DATABASE_NAME_1"
8796
}
8897
]
89-
},
90-
"production": {
91-
"d1_databases": [
92-
{
93-
"binding": "BINDING_NAME_2",
94-
"database_name": "DATABASE_NAME_2",
95-
"database_id": "UUID_2"
96-
}
97-
]
98-
}
99-
}
98+
}
10099
}
101100
}
102101
```

0 commit comments

Comments
 (0)