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
A `$today` value can be used in this component to automatically insert the today's date. This is useful for suggesting that users set the latest compatibility date.
32
32
33
-
34
33
````mdx live
35
34
import { WranglerConfig } from"~/components";
36
35
@@ -42,5 +41,21 @@ import { WranglerConfig } from "~/components";
42
41
}
43
42
```
44
43
</WranglerConfig>
44
+
````
45
+
46
+
The `removeSchema` prop can be used to remove the `$schema` reference from the generated JSON file. This can be useful if you want to add snippets of configuration files that are easier to copy paste, and are providing toml as the source config format.
47
+
48
+
If you provide jsonc as the source config format, the `removeSchema` prop will be ignored.
49
+
50
+
````mdx live
51
+
import { WranglerConfig } from"~/components";
45
52
46
-
````
53
+
<WranglerConfigremoveSchema>
54
+
```toml
55
+
[[d1_databases]]
56
+
binding = "DB"# available in your Worker on env.DB
Wrangler can automatically provision resources for you when you deploy your Worker without you having to create them ahead of time.
84
+
85
+
This currently works for KV, R2, and D1 bindings.
86
+
87
+
To use this feature, add bindings to your configuration file _without_ adding resource IDs, or in the case of R2, a bucket name. Resources will be created with the name of your worker as the prefix.
88
+
89
+
<WranglerConfigremoveSchema>
90
+
91
+
```toml
92
+
kv_namespaces = [
93
+
{ binding = "<MY_KV_NAMESPACE>" }
94
+
]
95
+
```
96
+
97
+
</WranglerConfig>
98
+
99
+
When you run `wrangler dev`, local resources will automatically be created which persist between runs. When you run `wrangler deploy`, resources will be created for you, and their IDs will be written back to your configuration file.
100
+
101
+
If you deploy a worker with resources and no resource IDs from the dashboard (for example, via GitHub), resources will be created, but their IDs will only be accessible via the dashboard. Currently, these resource IDs will not be written back to your repository.
102
+
74
103
## Top-level only keys
75
104
76
105
Top-level keys apply to the Worker as a whole (and therefore all environments). They cannot be defined within named environments.
@@ -1422,35 +1451,34 @@ A common example of using a redirected configuration is where a custom build too
1422
1451
-`my-tool` generates a `dist` directory that contains both compiled code and a new generated deployment configuration file, containing only the settings for the given environment.
1423
1452
It also creates a `.wrangler/deploy/config.json` file that redirects Wrangler to the new, generated deployment configuration file:
1424
1453
1425
-
<FileTree>
1426
-
- dist
1427
-
- index.js
1428
-
- wrangler.jsonc
1429
-
- .wrangler
1430
-
- deploy
1431
-
- config.json
1432
-
1433
-
</FileTree>
1434
-
1435
-
The generated `dist/wrangler.jsonc` might contain:
1436
-
1437
-
```json
1438
-
{
1439
-
"name": "my-worker",
1440
-
"main": "./index.js",
1441
-
"vars": {
1442
-
"MY_VARIABLE": "staging variable"
1443
-
}
1444
-
}
1445
-
```
1454
+
<FileTree>
1455
+
- dist
1456
+
- index.js
1457
+
- wrangler.jsonc
1458
+
- .wrangler
1459
+
- deploy
1460
+
- config.json
1461
+
</FileTree>
1462
+
1463
+
The generated `dist/wrangler.jsonc` might contain:
1464
+
1465
+
```json
1466
+
{
1467
+
"name": "my-worker",
1468
+
"main": "./index.js",
1469
+
"vars": {
1470
+
"MY_VARIABLE": "staging variable"
1471
+
}
1472
+
}
1473
+
```
1446
1474
1447
-
Now, the `main` property points to the generated code entry-point, no environment is defined,
1448
-
and the `MY_VARIABLE` variable is resolved to the staging environment value.
1475
+
Now, the `main` property points to the generated code entry-point, no environment is defined,
1476
+
and the `MY_VARIABLE` variable is resolved to the staging environment value.
1449
1477
1450
-
And the `.wrangler/deploy/config.json` contains the path to the generated configuration file:
1478
+
And the `.wrangler/deploy/config.json` contains the path to the generated configuration file:
0 commit comments