Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Add individual write subcommand for Workers KV #458

Merged
merged 7 commits into from
Aug 21, 2019

Conversation

gabbifish
Copy link
Contributor

@gabbifish gabbifish commented Aug 19, 2019

This PR closes #343.

The SET behavior is used the following way:

Success case (set string value):

$ wrangler kv set-key 06779da6940b431db6e566b4846d64db taylor swift --ttl 60
 Success

Success case (set value from file contents)

$ wrangler kv write-key 06779da6940b431db6e566b4846d64db my_file abc/a.txt --ttl 60 -f
 Success

Failure cases

$ wrangler kv write-key 06779da6940b431db6e566b4846d63db --ttl 60 -f my_file abc/a.txt
 Error 10013: namespace not found
 Run `wrangler kv list` to see your existing namespaces with IDs
$ wrangler kv write-key 06779da6940b431db6e566b4846d64db --ttl 60 -f my_file abc/ab.txt
Error: No such file or directory (os error 2)

^ There is the standard emoji logic here, it just doesn't show up in Ubuntu for now...

In a future PR, we'll use cloudflare-rs for this; its usage is unfortunately blocked due to cloudflare/cloudflare-rs#27 (cloudflare-rs doesn't support non-json API responses, and the GET operation for Workers KV keys returns raw text on success).

@gabbifish gabbifish changed the base branch from master to feat-kv-commands August 19, 2019 23:58
@ashleymichal
Copy link
Contributor

this command should be "write"

@gabbifish gabbifish changed the title Add kv set key Add individual write subcommand for Workers KV Aug 20, 2019
@ashleymichal ashleymichal added this to the Add KV Subcommands milestone Aug 20, 2019
@ashleymichal ashleymichal added changelog - feature regression Something is broken, but works in previous releases blocked and removed status - needs review blocked labels Aug 20, 2019
@gabbifish gabbifish merged commit a1ff27a into feat-kv-commands Aug 21, 2019
@delete-merged-branch delete-merged-branch bot deleted the gabbi/add-kv-set-key branch August 21, 2019 05:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Something is broken, but works in previous releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants