CLI tool for interacting with the Cloudflare Worker Key Value store.
This CLI tool interacts with the Cloudflare API, documented here. The response from the API is piped to stdout, so you can pipe it to files or other tools.
The usual way:
npm install -g cloudflare-worker-key-value
This adds the CLI command cfwkv
to your environment.
You will need to pass in configuration details, such as your Cloudflare account email address, zone identifier, and the token key.
Pass those properties in by either setting them with the CLI parameter, e.g. [email protected]
or by setting the appropriate environment variable. (Pass in the --help
flag for more details.)
Create a namespace:
$ cfwkv namespace create "My Test Namespace"
{
"result": {
"id": "b39d89e33d3c4cc99697afde12958bf9",
"title": "My Test Namespace",
"supports_url_encoding": true
},
"success": true,
"errors": [],
"messages": []
}
Set a key value in that namespace:
$ cfwkv key set b39d89e33d3c4cc99697afde12958bf9 key1 "hello world"
{
"result": null,
"success": true,
"errors": [],
"messages": []
}
Get a key value in that namespace:
$ cfwkv key get b39d89e33d3c4cc99697afde12958bf9 key1
hello world
This CLI tool doesn't yet support the bulk operations, but if you need them please open a new issue in Github and I can add them.
All content released and published under the Very Open License.
Made with love ❤️ by Tobias Davis