@flaghoist/adapter-postgres 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 +43 -0
- package/package.json +18 -2
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @flaghoist/adapter-postgres
|
|
2
|
+
|
|
3
|
+
Store Flaghoist flags in Postgres, in a single jsonb table. Works with any node-postgres compatible
|
|
4
|
+
client, so a `Pool` from `pg` is the usual starting point.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @flaghoist/adapter-postgres pg
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { postgresAdapter, postgresSchema } from '@flaghoist/adapter-postgres'
|
|
12
|
+
import { Pool } from 'pg'
|
|
13
|
+
|
|
14
|
+
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
|
|
15
|
+
|
|
16
|
+
createFlagServer({
|
|
17
|
+
storage: postgresAdapter(pool),
|
|
18
|
+
auth: {/* ... */},
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Create the table first. `postgresSchema()` gives you the SQL rather than running migrations behind
|
|
23
|
+
your back:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
await pool.query(postgresSchema())
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Pass a name if you want it somewhere other than `flaghoist_flags`.
|
|
30
|
+
|
|
31
|
+
This is the one to choose when your flags should live in a database you already back up, or when the
|
|
32
|
+
database sits inside a VPC that a Worker cannot reach anyway. Note that it wants a real TCP
|
|
33
|
+
connection, so it suits Node, Bun or a container rather than an edge runtime.
|
|
34
|
+
|
|
35
|
+
Validated by the same conformance suite as the other adapters.
|
|
36
|
+
|
|
37
|
+
## Status
|
|
38
|
+
|
|
39
|
+
Pre-alpha, built and maintained by one person. The API can still change without notice, and
|
|
40
|
+
production use is not recommended yet. If you try it and something breaks, an issue is genuinely
|
|
41
|
+
useful.
|
|
42
|
+
|
|
43
|
+
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-postgres",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Postgres StorageAdapter for Flaghoist — stores flags in a jsonb table via any node-postgres client.",
|
|
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
|
"pg-mem": "^3.0.14",
|
|
@@ -36,6 +36,22 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"feature-flags",
|
|
41
|
+
"storage",
|
|
42
|
+
"postgres",
|
|
43
|
+
"postgresql",
|
|
44
|
+
"jsonb"
|
|
45
|
+
],
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/flaghoist/flaghoist.git",
|
|
49
|
+
"directory": "packages/adapters/postgres"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/flaghoist/flaghoist#readme",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/flaghoist/flaghoist/issues"
|
|
54
|
+
},
|
|
39
55
|
"scripts": {
|
|
40
56
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
41
57
|
"test": "vitest run --passWithNoTests",
|