@mccaskie-labs/workbench-config 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/CHANGELOG.md +6 -0
- package/capabilities/config.md +23 -0
- package/dist/cli.js +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mccaskie-labs/workbench-config
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Ship the config guide (`capabilities/config.md`) with the manifests.
|
|
8
|
+
|
|
3
9
|
## 0.1.0
|
|
4
10
|
|
|
5
11
|
- First release: `workbenchEnv`, `defineConfig`, `workerSecret`, `sharedSecret`, `redact`, `redactAll`, the capabilities manifests (`gateway`, `config`, `ai`) with `capabilitySchema`, and the `workbench-config check` CLI.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Config
|
|
2
|
+
|
|
3
|
+
Every Workbench app reads its settings through `@mccaskie-labs/workbench-config`, so a missing or wrong variable stops the app at startup with the variable's name, and no value ever reaches a log or an error.
|
|
4
|
+
|
|
5
|
+
## The environment
|
|
6
|
+
|
|
7
|
+
`WORKBENCH_ENV` is `development`, `staging` or `production`. It is required in every environment and has no fallback: not `NODE_ENV`, not a default. The Gateway key's own environment must match it (`gateway.key-per-environment`).
|
|
8
|
+
|
|
9
|
+
## Declaring variables
|
|
10
|
+
|
|
11
|
+
Declare every variable the app reads with `defineConfig`, once, at module level, and call `parse(env)` in the handler. Use zod to say what a valid value looks like: `z.string().startsWith('wbk_')` for a Gateway key, `z.coerce.number()` for numbers, `.default()` for optional settings.
|
|
12
|
+
|
|
13
|
+
An empty string counts as missing, so a blank line in `.dev.vars` fails the same way as no line.
|
|
14
|
+
|
|
15
|
+
## Secrets
|
|
16
|
+
|
|
17
|
+
- Worker secrets: read them through `defineConfig` or `workerSecret(env, name)`.
|
|
18
|
+
- Secrets Store bindings: `await sharedSecret(env.BINDING, 'NAME')`.
|
|
19
|
+
- Logging anything near a secret: `redact(value)` or `redactAll(text, [secrets])`. Both write `[redacted]` and keep nothing of the value.
|
|
20
|
+
|
|
21
|
+
## Local development
|
|
22
|
+
|
|
23
|
+
`.dev.vars` holds local values and is gitignored. `.dev.vars.example` lists the same names with no values and is committed. `npx workbench-config check` compares the two and prints names only.
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mccaskie-labs/workbench-config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Workbench app configuration: WORKBENCH_ENV, typed variables that fail by name, secrets that are never printed, and the capabilities manifest.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|