add dotenv support to wrangler secret bulk#7674
Conversation
🦋 Changeset detectedLatest commit: 3bd3768 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-wrangler-7674You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7674/npm-package-wrangler-7674Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-wrangler-7674 dev path/to/script.jsAdditional artifacts:wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workers-bindings-extension-7674 -O ./cloudflare-workers-bindings-extension.0.0.0-v7d1f2fb5d.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v7d1f2fb5d.vsixnpx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-create-cloudflare-7674 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-kv-asset-handler-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-miniflare-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-pages-shared-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-unenv-preset-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-vitest-pool-workers-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workers-editor-shared-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workers-shared-7674npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workflows-shared-7674Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
d66cd60 to
29ec739
Compare
1ce2664 to
6b9707e
Compare
…are/workers-sdk into thomas/secret-put-dotenv
… thomas/secret-put-dotenv
irvinebroque
left a comment
There was a problem hiding this comment.
So this is basically
Before: you can pass wrangler secret bulk a path to a file, but has to be JSON
After: you can pass wrangler secret bulk a path to a file, and that file can be either JSON, or KEY=VALUE ala env vars
...making it easy to go "I have a .env file, I want to add all of it to secrets.
...but not coupling it specifically to the filename .env, or to dotenv behaviors, etc.
Correct?
Exactly |
In Wrangler's case, I think it'd likely be a case of having a |
| "wrangler": minor | ||
| --- | ||
|
|
||
| Add support for env files to wrangler secret bulk |
There was a problem hiding this comment.
Could you expand this with an example, and call out .dev.vars?
|
|
||
| POSITIONALS | ||
| json The JSON file of key-value pairs to upload, in form {\\"key\\": value, ...} [string] | ||
| json The file of key-value pairs to upload, as JSON in form {\\"key\\": value, ...} or .env file in the form KEY=VALUE [string] |
There was a problem hiding this comment.
| json The file of key-value pairs to upload, as JSON in form {\\"key\\": value, ...} or .env file in the form KEY=VALUE [string] | |
| json The file of key-value pairs to upload, as JSON in form {\\"key\\": value, ...} or .dev.vars file in the form KEY=VALUE [string] |
I'm having a hard time seeing a reason not to do that — you give us file, we detect format |
Fixes #6388
Adds support for env files in all the secret bulk commands
Questions for the team:
currently the parsing is toggled between JSON and env by adding a flag
--experimental-env-file.Should this be made "no config" by trying to parse both and seeing which succeeds?
Will update the docs once the flag stuff is confirmed