@flaghoist/adapter-cloudflare-kv 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/package.json +17 -2
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @flaghoist/adapter-cloudflare-kv
|
|
2
|
+
|
|
3
|
+
Store Flaghoist flags in Cloudflare Workers KV. This is the default storage for a Flaghoist deploy,
|
|
4
|
+
and the one the CLI picks unless you tell it otherwise.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @flaghoist/adapter-cloudflare-kv
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { cloudflareKV } from '@flaghoist/adapter-cloudflare-kv'
|
|
12
|
+
import { createFlagServer } from '@flaghoist/server'
|
|
13
|
+
|
|
14
|
+
export default createFlagServer((env) => ({
|
|
15
|
+
storage: cloudflareKV(env.FLAGS),
|
|
16
|
+
auth: {/* ... */},
|
|
17
|
+
}))
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`FLAGS` is a KV namespace binding in your `wrangler.toml`. If you are using the CLI, `flaghoist
|
|
21
|
+
deploy` creates the namespace and fills in its id for you. By hand it is:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx wrangler kv namespace create FLAGS
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Worth knowing: KV is eventually consistent. A flag you just changed can take a few seconds to reach
|
|
28
|
+
every edge location, which is fine for flags and would not be fine for a bank balance.
|
|
29
|
+
|
|
30
|
+
Storage is an interface, so moving to Redis or Postgres later is a one line change in your server
|
|
31
|
+
config.
|
|
32
|
+
|
|
33
|
+
## Status
|
|
34
|
+
|
|
35
|
+
Pre-alpha, built and maintained by one person. The API can still change without notice, and
|
|
36
|
+
production use is not recommended yet. If you try it and something breaks, an issue is genuinely
|
|
37
|
+
useful.
|
|
38
|
+
|
|
39
|
+
Apache-2.0. Part of [Flaghoist](https://github.com/flaghoist/flaghoist).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flaghoist/adapter-cloudflare-kv",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Cloudflare Workers KV StorageAdapter for Flaghoist — the default storage backend.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=20"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@flaghoist/core": "0.1.
|
|
30
|
+
"@flaghoist/core": "0.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@flaghoist/adapter-conformance": "0.0.0"
|
|
@@ -35,6 +35,21 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"feature-flags",
|
|
40
|
+
"storage",
|
|
41
|
+
"cloudflare",
|
|
42
|
+
"workers-kv"
|
|
43
|
+
],
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/flaghoist/flaghoist.git",
|
|
47
|
+
"directory": "packages/adapters/cloudflare-kv"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/flaghoist/flaghoist#readme",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/flaghoist/flaghoist/issues"
|
|
52
|
+
},
|
|
38
53
|
"scripts": {
|
|
39
54
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
40
55
|
"test": "vitest run --passWithNoTests",
|