@forinda/kickjs-config 0.3.0 → 0.3.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 +41 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @forinda/kickjs-config
|
|
2
|
+
|
|
3
|
+
Zod-based environment validation and ConfigService for KickJS.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @forinda/kickjs-config @forinda/kickjs-core zod
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- `defineEnv()` — extend the base schema with app-specific env vars
|
|
14
|
+
- `loadEnv()` — validates `process.env` against your Zod schema (cached per schema)
|
|
15
|
+
- `ConfigService` — injectable service with `get()`, `isProduction()`, `isDevelopment()`
|
|
16
|
+
- `@Value('ENV_KEY', default?)` — property decorator for env injection
|
|
17
|
+
|
|
18
|
+
## Quick Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { defineEnv, loadEnv } from '@forinda/kickjs-config'
|
|
22
|
+
import { z } from 'zod'
|
|
23
|
+
|
|
24
|
+
const envSchema = defineEnv((base) =>
|
|
25
|
+
base.extend({
|
|
26
|
+
DATABASE_URL: z.string().url(),
|
|
27
|
+
JWT_SECRET: z.string().min(32),
|
|
28
|
+
}),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
const env = loadEnv(envSchema)
|
|
32
|
+
console.log(env.DATABASE_URL)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
[Full documentation](https://github.com/forinda/kick-js)
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Zod-based environment validation and typed configuration for KickJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"dotenv": "^17.3.1",
|
|
19
19
|
"zod": "^4.3.6",
|
|
20
|
-
"@forinda/kickjs-core": "0.3.
|
|
20
|
+
"@forinda/kickjs-core": "0.3.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@swc/core": "^1.7.28",
|