-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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-7674 You 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-7674 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-wrangler-7674 dev path/to/script.js Additional 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.vsix npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-create-cloudflare-7674 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-kv-asset-handler-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-miniflare-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-pages-shared-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-unenv-preset-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-vitest-pool-workers-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workers-editor-shared-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workers-shared-7674 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12695830110/npm-package-cloudflare-workflows-shared-7674 Note 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
.changeset/silver-plums-brake.md
Outdated
"wrangler": minor | ||
--- | ||
|
||
Add support for env files to wrangler secret bulk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand this with an example, and call out .dev.vars
?
@@ -1065,7 +1087,7 @@ describe("wrangler secret", () => { | |||
"wrangler secret:bulk [json] | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
* add dotenv support to wrangler secret bulk * remove x-versions arg * remove old --x-versions flag * PR feedback --------- Co-authored-by: Thomas Ankcorn <tankcorn@cloudflare.com>
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