@venizia/ignis-docs 0.2.0 → 0.2.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 +14 -14
- package/content/best-practices/api-usage-examples.md +39 -19
- package/content/best-practices/architectural-patterns.md +24 -13
- package/content/best-practices/architecture-decisions.md +29 -16
- package/content/best-practices/code-style-standards/advanced-patterns.md +43 -31
- package/content/best-practices/code-style-standards/constants-configuration.md +19 -4
- package/content/best-practices/code-style-standards/control-flow.md +33 -1
- package/content/best-practices/code-style-standards/documentation.md +28 -8
- package/content/best-practices/code-style-standards/function-patterns.md +15 -4
- package/content/best-practices/code-style-standards/index.md +7 -2
- package/content/best-practices/code-style-standards/naming-conventions.md +27 -3
- package/content/best-practices/code-style-standards/route-definitions.md +9 -5
- package/content/best-practices/code-style-standards/tooling.md +14 -1
- package/content/best-practices/code-style-standards/type-safety.md +39 -6
- package/content/best-practices/common-pitfalls.md +59 -35
- package/content/best-practices/contribution-workflow.md +8 -4
- package/content/best-practices/data-modeling.md +78 -62
- package/content/best-practices/deployment-strategies.md +56 -19
- package/content/best-practices/error-handling.md +247 -153
- package/content/best-practices/index.md +6 -0
- package/content/best-practices/performance-optimization.md +26 -13
- package/content/best-practices/security-guidelines.md +35 -9
- package/content/best-practices/testing-strategies.md +7 -2
- package/content/best-practices/troubleshooting-tips.md +27 -17
- package/content/extensions/components/api-reference.md +109 -323
- package/content/extensions/components/authentication/api.md +489 -602
- package/content/extensions/components/authentication/errors.md +135 -498
- package/content/extensions/components/authentication/index.md +89 -801
- package/content/extensions/components/authentication/usage.md +231 -955
- package/content/extensions/components/authorization/api.md +991 -644
- package/content/extensions/components/authorization/errors.md +204 -208
- package/content/extensions/components/authorization/getting-started.md +227 -0
- package/content/extensions/components/authorization/index.md +88 -795
- package/content/extensions/components/authorization/usage.md +219 -528
- package/content/extensions/components/health-check.md +77 -243
- package/content/extensions/components/index.md +24 -90
- package/content/extensions/components/mail/api.md +553 -285
- package/content/extensions/components/mail/errors.md +76 -62
- package/content/extensions/components/mail/index.md +111 -463
- package/content/extensions/components/mail/usage.md +139 -173
- package/content/extensions/components/request-tracker.md +70 -173
- package/content/extensions/components/socket-io/api.md +462 -785
- package/content/extensions/components/socket-io/errors.md +49 -51
- package/content/extensions/components/socket-io/index.md +69 -372
- package/content/extensions/components/socket-io/usage.md +212 -105
- package/content/extensions/components/static-asset/api.md +461 -141
- package/content/extensions/components/static-asset/errors.md +121 -53
- package/content/extensions/components/static-asset/index.md +84 -606
- package/content/extensions/components/static-asset/usage.md +184 -299
- package/content/extensions/components/template/index.md +3 -3
- package/content/extensions/components/websocket/api.md +311 -404
- package/content/extensions/components/websocket/errors.md +47 -56
- package/content/extensions/components/websocket/index.md +75 -407
- package/content/extensions/components/websocket/usage.md +120 -338
- package/content/extensions/helpers/cron/index.md +52 -160
- package/content/extensions/helpers/crypto/index.md +67 -480
- package/content/extensions/helpers/crypto/reference.md +528 -0
- package/content/extensions/helpers/env/index.md +64 -178
- package/content/extensions/helpers/error/index.md +286 -196
- package/content/extensions/helpers/index.md +61 -47
- package/content/extensions/helpers/inversion/index.md +76 -550
- package/content/extensions/helpers/inversion/reference.md +530 -0
- package/content/extensions/helpers/kafka/admin.md +23 -3
- package/content/extensions/helpers/kafka/compile-binary.md +83 -52
- package/content/extensions/helpers/kafka/consumer.md +65 -28
- package/content/extensions/helpers/kafka/examples.md +46 -253
- package/content/extensions/helpers/kafka/index.md +55 -617
- package/content/extensions/helpers/kafka/producer.md +156 -22
- package/content/extensions/helpers/kafka/schema-registry.md +59 -79
- package/content/extensions/helpers/logger/hf-logger.md +220 -0
- package/content/extensions/helpers/logger/index.md +78 -552
- package/content/extensions/helpers/logger/pino.md +105 -0
- package/content/extensions/helpers/logger/reference.md +937 -0
- package/content/extensions/helpers/network/api.md +276 -195
- package/content/extensions/helpers/network/index.md +87 -524
- package/content/extensions/helpers/queue/index.md +80 -897
- package/content/extensions/helpers/queue/reference.md +494 -0
- package/content/extensions/helpers/redis/index.md +86 -640
- package/content/extensions/helpers/redis/reference.md +784 -0
- package/content/extensions/helpers/secrets/index.md +136 -0
- package/content/extensions/helpers/socket-io/api.md +325 -204
- package/content/extensions/helpers/socket-io/index.md +79 -429
- package/content/extensions/helpers/storage/api.md +584 -464
- package/content/extensions/helpers/storage/index.md +80 -573
- package/content/extensions/helpers/types/index.md +75 -495
- package/content/extensions/helpers/types/reference.md +689 -0
- package/content/extensions/helpers/uid/index.md +176 -189
- package/content/extensions/helpers/websocket/api.md +366 -214
- package/content/extensions/helpers/websocket/index.md +68 -503
- package/content/extensions/helpers/worker-thread/index.md +62 -396
- package/content/extensions/helpers/worker-thread/reference.md +428 -0
- package/content/extensions/index.md +38 -39
- package/content/extensions/src-details/mcp-server.md +96 -548
- package/content/guides/core-concepts/persistent/datasources.md +2 -2
- package/content/guides/core-concepts/persistent/index.md +5 -1
- package/content/guides/core-concepts/persistent/models.md +1 -1
- package/content/guides/core-concepts/persistent/pglite.md +218 -0
- package/content/guides/core-concepts/persistent/postgres-drivers.md +21 -15
- package/content/guides/core-concepts/persistent/search-meilisearch.md +22 -12
- package/content/guides/core-concepts/persistent/search-typesense.md +28 -16
- package/content/guides/core-concepts/persistent/sqlite.md +296 -0
- package/content/guides/core-concepts/persistent/transactions.md +12 -11
- package/content/guides/core-concepts/secrets-vault.md +177 -0
- package/content/guides/core-concepts/services.md +1 -1
- package/content/guides/get-started/5-minute-quickstart.md +59 -206
- package/content/guides/get-started/philosophy.md +135 -670
- package/content/guides/get-started/setup.md +53 -74
- package/content/guides/migrations/redis-helpers-migration.md +5 -4
- package/content/guides/migrations/scoped-rbac-migration.md +5 -5
- package/content/guides/migrations/unified-connectors-migration.md +8 -7
- package/content/guides/tutorials/ecommerce-api.md +3 -8
- package/content/guides/tutorials/realtime-chat.md +1 -1
- package/content/references/base/application.md +64 -22
- package/content/references/base/components.md +3 -3
- package/content/references/base/connectors.md +79 -136
- package/content/references/base/controllers.md +12 -12
- package/content/references/base/datasources-reference.md +600 -0
- package/content/references/base/datasources.md +84 -444
- package/content/references/base/dependency-injection.md +25 -46
- package/content/references/base/filter-system/application-usage.md +95 -123
- package/content/references/base/filter-system/array-operators.md +33 -43
- package/content/references/base/filter-system/comparison-operators.md +55 -63
- package/content/references/base/filter-system/default-filter.md +144 -350
- package/content/references/base/filter-system/fields-order-pagination.md +116 -148
- package/content/references/base/filter-system/index.md +114 -253
- package/content/references/base/filter-system/json-filtering.md +52 -181
- package/content/references/base/filter-system/list-operators.md +28 -44
- package/content/references/base/filter-system/logical-operators.md +69 -114
- package/content/references/base/filter-system/null-operators.md +41 -98
- package/content/references/base/filter-system/pattern-matching.md +48 -51
- package/content/references/base/filter-system/quick-reference.md +93 -196
- package/content/references/base/filter-system/range-operators.md +22 -38
- package/content/references/base/filter-system/tips.md +70 -133
- package/content/references/base/filter-system/use-cases.md +173 -232
- package/content/references/base/grpc-controllers.md +53 -17
- package/content/references/base/index.md +5 -3
- package/content/references/base/middlewares.md +43 -28
- package/content/references/base/models-reference.md +886 -0
- package/content/references/base/models.md +81 -1452
- package/content/references/base/providers.md +8 -8
- package/content/references/base/repositories/advanced.md +281 -419
- package/content/references/base/repositories/index.md +84 -644
- package/content/references/base/repositories/mixins.md +25 -21
- package/content/references/base/repositories/relations.md +194 -375
- package/content/references/base/repositories/soft-deletable.md +67 -55
- package/content/references/base/secrets.md +267 -0
- package/content/references/base/services.md +8 -6
- package/content/references/configuration/environment-variables.md +73 -21
- package/content/references/configuration/index.md +51 -31
- package/content/references/index.md +1 -1
- package/content/references/quick-reference.md +3 -16
- package/content/references/utilities/crypto.md +35 -76
- package/content/references/utilities/date.md +33 -73
- package/content/references/utilities/duration.md +85 -0
- package/content/references/utilities/index.md +6 -2
- package/content/references/utilities/jsx-reference.md +298 -0
- package/content/references/utilities/jsx.md +82 -525
- package/content/references/utilities/module.md +81 -61
- package/content/references/utilities/parse.md +34 -64
- package/content/references/utilities/performance.md +33 -58
- package/content/references/utilities/promise.md +28 -62
- package/content/references/utilities/request.md +58 -218
- package/content/references/utilities/retry.md +139 -0
- package/content/references/utilities/schema.md +43 -137
- package/content/references/utilities/statuses-reference.md +361 -0
- package/content/references/utilities/statuses.md +63 -667
- package/dist/mcp-server/index.js +0 -0
- package/dist/mcp-server/tools/github/list-project-files.tool.d.ts +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.js +3 -3
- package/dist/mcp-server/tools/github/search-code.tool.js +1 -1
- package/dist/mcp-server/tools/github/verify-dependencies.tool.js +1 -1
- package/dist/mcp-server/tools/github/view-source-file.tool.js +1 -1
- package/package.json +24 -23
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
# Environment Variables Reference
|
|
2
2
|
|
|
3
|
-
Complete reference of all environment variables used by IGNIS framework.
|
|
3
|
+
Complete reference of all environment variables used by the IGNIS framework, grouped by category with defaults and required/optional status.
|
|
4
4
|
|
|
5
|
+
**Files:**
|
|
6
|
+
|
|
7
|
+
- [`packages/core-server/src/common/environments.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/common/environments.ts) - `EnvironmentKeys`
|
|
8
|
+
- [`packages/helpers/src/modules/env/app-env.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/env/app-env.ts) - `applicationEnvironment`, `Environment`
|
|
9
|
+
- [`packages/core-server/src/base/applications/abstract.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/base/applications/abstract.ts) - `validateEnvs()`, host/port resolution priority
|
|
10
|
+
- [`packages/core-server/src/base/applications/base.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/base/applications/base.ts) - `registerSecrets()`, `hydrateSecrets()`
|
|
11
|
+
- [`packages/helpers/src/modules/secrets/common/constants.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/secrets/common/constants.ts) - `SecretProviders`, `VaultAuthMethods`
|
|
12
|
+
- [`packages/helpers/src/modules/secrets/hashicorp/hashicorp.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/secrets/hashicorp/hashicorp.helper.ts) - HashiCorp Vault helper
|
|
5
13
|
|
|
6
14
|
## Overview
|
|
7
15
|
|
|
@@ -35,38 +43,38 @@ Create a `.env` file in your project root:
|
|
|
35
43
|
```bash
|
|
36
44
|
# .env
|
|
37
45
|
|
|
38
|
-
#
|
|
46
|
+
# ----------------------
|
|
39
47
|
# APPLICATION
|
|
40
|
-
#
|
|
48
|
+
# ----------------------
|
|
41
49
|
APP_ENV_APPLICATION_NAME=my-app
|
|
42
50
|
APP_ENV_APPLICATION_TIMEZONE=UTC
|
|
43
51
|
|
|
44
|
-
#
|
|
52
|
+
# ----------------------
|
|
45
53
|
# SERVER
|
|
46
|
-
#
|
|
54
|
+
# ----------------------
|
|
47
55
|
APP_ENV_SERVER_HOST=0.0.0.0
|
|
48
56
|
APP_ENV_SERVER_PORT=3000
|
|
49
57
|
APP_ENV_SERVER_BASE_PATH=/api
|
|
50
58
|
|
|
51
|
-
#
|
|
59
|
+
# ----------------------
|
|
52
60
|
# DATABASE (PostgreSQL)
|
|
53
|
-
#
|
|
61
|
+
# ----------------------
|
|
54
62
|
APP_ENV_POSTGRES_HOST=localhost
|
|
55
63
|
APP_ENV_POSTGRES_PORT=5432
|
|
56
64
|
APP_ENV_POSTGRES_USERNAME=postgres
|
|
57
65
|
APP_ENV_POSTGRES_PASSWORD=your_password_here
|
|
58
66
|
APP_ENV_POSTGRES_DATABASE=my_database
|
|
59
67
|
|
|
60
|
-
#
|
|
68
|
+
# ----------------------
|
|
61
69
|
# AUTHENTICATION
|
|
62
|
-
#
|
|
70
|
+
# ----------------------
|
|
63
71
|
APP_ENV_APPLICATION_SECRET=generate-a-strong-random-secret
|
|
64
72
|
APP_ENV_JWT_SECRET=generate-another-strong-random-secret
|
|
65
73
|
APP_ENV_JWT_EXPIRES_IN=86400
|
|
66
74
|
|
|
67
|
-
#
|
|
75
|
+
# ----------------------
|
|
68
76
|
# LOGGING
|
|
69
|
-
#
|
|
77
|
+
# ----------------------
|
|
70
78
|
APP_ENV_LOGGER_FOLDER_PATH=./logs
|
|
71
79
|
```
|
|
72
80
|
|
|
@@ -116,7 +124,7 @@ APP_ENV_SERVER_BASE_PATH=/v1/api
|
|
|
116
124
|
|
|
117
125
|
### Priority Order
|
|
118
126
|
|
|
119
|
-
The server host/port resolution uses this priority (`packages/core/src/base/applications/abstract.ts`):
|
|
127
|
+
The server host/port resolution uses this priority (`packages/core-server/src/base/applications/abstract.ts`):
|
|
120
128
|
1. Explicit config passed to the application constructor
|
|
121
129
|
2. `HOST`/`PORT` variables (for cloud platforms)
|
|
122
130
|
3. `APP_ENV_SERVER_HOST`/`APP_ENV_SERVER_PORT` variables
|
|
@@ -189,7 +197,9 @@ export class PostgresDataSource extends BaseDataSource {
|
|
|
189
197
|
|
|
190
198
|
### Security Requirements
|
|
191
199
|
|
|
192
|
-
The `AuthenticateComponent` receives its secrets programmatically via the `jwtOptions` binding (`jwtSecret`, `getTokenExpiresFn`)
|
|
200
|
+
- **Not read directly.** The `AuthenticateComponent` receives its secrets programmatically via the `jwtOptions` binding (`jwtSecret`, `getTokenExpiresFn`) - it never reads these environment variables itself.
|
|
201
|
+
- **`EnvironmentKeys` is the convention, not a requirement.** These constants are the conventional way for your application to supply those values into the binding.
|
|
202
|
+
- **A missing or placeholder secret fails the boot.** The component throws at startup if `jwtSecret` is missing or left at the placeholder value. Wiring it from an unset environment variable fails the same way.
|
|
193
203
|
|
|
194
204
|
### Generate Strong Secrets
|
|
195
205
|
|
|
@@ -221,9 +231,12 @@ APP_ENV_JWT_EXPIRES_IN=86400
|
|
|
221
231
|
|
|
222
232
|
| Variable | Required | Default | Description |
|
|
223
233
|
|----------|----------|---------|-------------|
|
|
224
|
-
| `APP_ENV_LOGGER_FOLDER_PATH` | No |
|
|
234
|
+
| `APP_ENV_LOGGER_FOLDER_PATH` | No | _(unset)_ | Directory for log files; file logging is OFF when unset |
|
|
225
235
|
| `APP_ENV_LOGGER_FORMAT` | No | `text` | Log output format |
|
|
236
|
+
| `APP_ENV_LOGGER_LEVEL` | No | `debug` | Logger-level floor; transports without their own level inherit it |
|
|
226
237
|
| `APP_ENV_LOGGER_INSPECT_DEPTH` | No | `5` | How deep a `%s` argument is inspected. Node hard-codes depth `0` for `%s`, which prints `[Object]` one level in; IGNIS widens it. Non-negative integers only - an absent, invalid or negative value falls back to `5` |
|
|
238
|
+
| `APP_ENV_LOGGER_DO_REDACT` | No | `true` | Secret redaction in logged values. ONLY the literal `false` disables it (reveals raw credentials in log lines); anything else keeps redaction ON. Never disable in production |
|
|
239
|
+
| `APP_ENV_LOGGER_COLOR` | No | _(unset)_ | ANSI color on console log lines. Unset means auto: ON in a development `NODE_ENV`, OFF in `production`, `staging`, `uat` and any unrecognized name. `NO_COLOR` also turns it off |
|
|
227
240
|
| `APP_ENV_LOGGER_FILE_FREQUENCY` | No | `1h` | Log file rotation frequency |
|
|
228
241
|
| `APP_ENV_LOGGER_FILE_MAX_SIZE` | No | `100m` | Max size per log file |
|
|
229
242
|
| `APP_ENV_LOGGER_FILE_MAX_FILES` | No | `5d` | Log file retention |
|
|
@@ -316,9 +329,14 @@ APP_ENV_MAIL_REFRESH_TOKEN=your-oauth2-refresh-token
|
|
|
316
329
|
|
|
317
330
|
| Variable | Required | Default | Description |
|
|
318
331
|
|----------|----------|---------|-------------|
|
|
319
|
-
| `
|
|
320
|
-
| `
|
|
321
|
-
| `
|
|
332
|
+
| `APP_ENV_DS_MIGRATION` | No | `postgres` | DataSource name for migrations. Read at boot and printed in the startup banner |
|
|
333
|
+
| `APP_ENV_DS_AUTHORIZE` | No | `postgres` | DataSource name for authorization. Read at boot and printed in the startup banner |
|
|
334
|
+
| `APP_ENV_AUTO_PROVISION_COLLECTION` | No | `false` | Lets a search datasource create a missing collection on first use. `true` or `1` enables it; the `autoProvision` constructor option overrides it |
|
|
335
|
+
|
|
336
|
+
> [!WARNING] These two name the datasource, they do not select it
|
|
337
|
+
> `APP_ENV_DS_MIGRATION` and `APP_ENV_DS_AUTHORIZE` reach the startup banner and nothing else - the framework does not resolve a datasource from either. Wire your own lookup if you need one.
|
|
338
|
+
|
|
339
|
+
`Environments` (`packages/core-server/src/common/environments.ts`) also declares `APP_ENV_APPLICATION_DS_MIGRATION`, `APP_ENV_APPLICATION_DS_AUTHORIZE` and `APP_ENV_APPLICATION_DS_OAUTH2`. Those are name constants with no reader anywhere in the framework - setting them changes nothing.
|
|
322
340
|
|
|
323
341
|
|
|
324
342
|
## Debug Variables
|
|
@@ -328,8 +346,11 @@ APP_ENV_MAIL_REFRESH_TOKEN=your-oauth2-refresh-token
|
|
|
328
346
|
| `DEBUG` | No | - | Enable debug mode |
|
|
329
347
|
| `NODE_ENV` | No | `development` | Environment mode. One of `local`, `debug`, `development`, `dev`, `sit`, `uat`, `alpha`, `beta`, `staging`, `production` |
|
|
330
348
|
| `ALLOW_EMPTY_ENV_VALUE` | No | `false` | Allow empty env values |
|
|
349
|
+
| `RUN_MODE` | No | - | Printed in the startup banner. The framework never branches on it - read it yourself to split a migrate run from a serve run |
|
|
331
350
|
|
|
332
|
-
|
|
351
|
+
- **Fail-closed by default.** An environment IGNIS does not recognize is treated as production, so error responses are sanitized.
|
|
352
|
+
- **Development environments expose error detail.** `local`, `debug`, `development`, `dev`, and `sit` are the development set - only these show internal error detail.
|
|
353
|
+
- **Everything else stays sanitized.** `alpha`, `beta`, `staging`, and `production` never expose internal detail, matching production behavior.
|
|
333
354
|
|
|
334
355
|
### Example
|
|
335
356
|
|
|
@@ -343,6 +364,29 @@ NODE_ENV=production
|
|
|
343
364
|
```
|
|
344
365
|
|
|
345
366
|
|
|
367
|
+
## Secrets & Vault
|
|
368
|
+
|
|
369
|
+
- **A `.env` file is one option, not a requirement.** IGNIS can load these variables from a vault (HashiCorp Vault, an encrypted `.env.vault`, or plain `process.env`). It **hydrates** them into the same `APP_ENV_*` keys at boot.
|
|
370
|
+
- **Hydration is transparent to your code.** Code that reads `process.env.APP_ENV_*` keeps working unchanged - the values arrive from the vault instead of a file.
|
|
371
|
+
- **Hydration runs before datasources are configured** (after `preConfigure()`, before `registerDataSources()`), so a hydrated `APP_ENV_DS_PASSWORD` is available exactly where a file-based one would be.
|
|
372
|
+
- **Vault values take precedence over `process.env`** when the provider is live - a hydrated key overwrites whatever was already in `process.env`.
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
// Store the key in the vault already named APP_ENV_... and it merges as-is.
|
|
376
|
+
override registerSecrets() {
|
|
377
|
+
return {
|
|
378
|
+
provider: SecretProviders.HASHICORP_VAULT,
|
|
379
|
+
config: { endpoint, auth: { method: VaultAuthMethods.APP_ROLE, roleId, secretId } },
|
|
380
|
+
hydrate: [{ path: 'secret/data/myapp/config' }],
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
> [!NOTE] Failure policy
|
|
386
|
+
> If the vault is unreachable, development environments (`local`, `debug`, `development`, `dev`, `sit`) fall back to `process.env`. Every other environment fails the boot rather than starting with missing secrets.
|
|
387
|
+
|
|
388
|
+
See the [Secrets & Vault guide](/guides/core-concepts/secrets-vault) for setup and the [Secrets & Vault reference](/references/base/secrets) for the full API.
|
|
389
|
+
|
|
346
390
|
## Environment-Specific Files
|
|
347
391
|
|
|
348
392
|
Create environment-specific `.env` files:
|
|
@@ -378,7 +422,7 @@ MY_APP_POSTGRES_HOST=localhost
|
|
|
378
422
|
|
|
379
423
|
## Validation
|
|
380
424
|
|
|
381
|
-
On startup, IGNIS iterates every `APP_ENV_*` (prefixed) variable that is set and throws if any has an empty value (`validateEnvs` in `packages/core/src/base/applications/abstract.ts`). It does not check for variables that are absent entirely - component-level validation (e.g., the authentication component's `jwtSecret` check) covers required values.
|
|
425
|
+
On startup, IGNIS iterates every `APP_ENV_*` (prefixed) variable that is set and throws if any has an empty value (`validateEnvs` in `packages/core-server/src/base/applications/abstract.ts`). It does not check for variables that are absent entirely - component-level validation (e.g., the authentication component's `jwtSecret` check) covers required values.
|
|
382
426
|
|
|
383
427
|
### Disable Validation
|
|
384
428
|
|
|
@@ -400,9 +444,9 @@ ALLOW_EMPTY_ENV_VALUE=true
|
|
|
400
444
|
## Complete .env.example
|
|
401
445
|
|
|
402
446
|
```bash
|
|
403
|
-
#
|
|
447
|
+
# ----------------------
|
|
404
448
|
# IGNIS ENVIRONMENT VARIABLES
|
|
405
|
-
#
|
|
449
|
+
# ----------------------
|
|
406
450
|
# Copy this file to .env and fill in values
|
|
407
451
|
|
|
408
452
|
# APPLICATION
|
|
@@ -444,3 +488,11 @@ APP_ENV_LOGGER_FOLDER_PATH=./logs
|
|
|
444
488
|
# APP_ENV_MAIL_CLIENT_SECRET=
|
|
445
489
|
# APP_ENV_MAIL_REFRESH_TOKEN=
|
|
446
490
|
```
|
|
491
|
+
|
|
492
|
+
## See also
|
|
493
|
+
|
|
494
|
+
- [Configuration Reference](./index.md) - `EnvironmentKeys` constants and the `applicationEnvironment` helper
|
|
495
|
+
- [Secrets & Vault Guide](/guides/core-concepts/secrets-vault) - setup walkthrough for vault-backed secrets
|
|
496
|
+
- [Secrets & Vault Reference](/references/base/secrets) - full provider API (`registerSecrets`, `SecretProviders`, `VaultAuthMethods`)
|
|
497
|
+
- [DataSources Guide](/guides/core-concepts/persistent/datasources) - wiring `APP_ENV_POSTGRES_*` into a DataSource
|
|
498
|
+
- [Logger Helper](/extensions/helpers/logger/) - `APP_ENV_LOGGER_*` variables in depth
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Configuration Reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
How IGNIS applications read configuration - the `APP_ENV_` variable convention, the `EnvironmentKeys` constants, and where to look up every value.
|
|
4
4
|
|
|
5
5
|
## Quick Reference
|
|
6
6
|
|
|
@@ -14,22 +14,20 @@ Configuration options and environment variables for IGNIS applications.
|
|
|
14
14
|
| Storage | MinIO/S3 file storage (application-level convention) | `APP_ENV_MINIO_HOST`, `APP_ENV_MINIO_ACCESS_KEY` |
|
|
15
15
|
| Mail | SMTP email sending (application-level convention) | `APP_ENV_MAIL_HOST`, `APP_ENV_MAIL_USER` |
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
**Full list:** [Environment Variables Reference](./environment-variables.md) - every `APP_ENV_*` variable, its default, and whether it's required.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## In one example
|
|
20
|
+
|
|
21
|
+
IGNIS uses the `APP_ENV_` prefix to avoid conflicts with system variables. Create a `.env` file in your project root:
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
24
|
# ✅ IGNIS variables
|
|
23
25
|
APP_ENV_POSTGRES_HOST=localhost
|
|
24
26
|
|
|
25
|
-
# ❌ Might conflict with system
|
|
27
|
+
# ❌ Might conflict with system variables
|
|
26
28
|
POSTGRES_HOST=localhost
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
## Quick Start
|
|
30
|
-
|
|
31
|
-
Create a `.env` file in your project root:
|
|
32
|
-
|
|
33
31
|
```bash
|
|
34
32
|
# .env
|
|
35
33
|
APP_ENV_APPLICATION_NAME=my-app
|
|
@@ -39,26 +37,40 @@ APP_ENV_POSTGRES_HOST=localhost
|
|
|
39
37
|
APP_ENV_POSTGRES_DATABASE=my_database
|
|
40
38
|
```
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- [Environment Variables](./environment-variables.md) - Complete reference of all `APP_ENV_*` variables
|
|
45
|
-
|
|
46
|
-
## Configuration Patterns
|
|
47
|
-
|
|
48
|
-
### 1. Accessing Variables
|
|
40
|
+
Read a value either directly or through the `applicationEnvironment` helper:
|
|
49
41
|
|
|
50
42
|
```typescript
|
|
51
43
|
// 1. Direct access
|
|
52
44
|
const host = process.env.APP_ENV_POSTGRES_HOST;
|
|
53
45
|
|
|
54
|
-
// 2. Using helper (recommended)
|
|
46
|
+
// 2. Using the helper (recommended)
|
|
55
47
|
import { applicationEnvironment } from '@venizia/ignis-helpers';
|
|
56
48
|
import { EnvironmentKeys } from '@venizia/ignis';
|
|
57
49
|
const host = applicationEnvironment.get<string>(EnvironmentKeys.APP_ENV_POSTGRES_HOST);
|
|
58
50
|
```
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
## How it works
|
|
53
|
+
|
|
54
|
+
- **One prefix, layered files.** Everything IGNIS reads is prefixed `APP_ENV_` (configurable - see the [Environment Variables Reference](./environment-variables.md#custom-environment-prefix)). Layer `.env`, `.env.local`, and `.env.{NODE_ENV}` the same way any dotenv-based tool does.
|
|
55
|
+
- **`applicationEnvironment` snapshots `process.env` once at import.** It's built from whatever is in `process.env` when `@venizia/ignis-helpers` loads.
|
|
56
|
+
- **Late values need an explicit merge.** A value set programmatically at runtime, after that snapshot, won't appear in `.keys()` unless merged in - secret hydration does this, see below.
|
|
57
|
+
- **Startup validation is fail-closed on emptiness, not absence.** IGNIS iterates every `APP_ENV_*` key that IS set and throws if its value is empty. It does not require a variable to exist at all.
|
|
58
|
+
- **Bypass and per-component checks.** Bypass emptiness validation with `ALLOW_EMPTY_ENV_VALUE=true`. Component-level checks (e.g., the authentication component's `jwtSecret` check) still cover values that must be present.
|
|
59
|
+
- **Secrets don't have to live in a file.** IGNIS can hydrate `APP_ENV_*` keys from a vault at boot, before datasources are configured - see [Secrets & Vault](./environment-variables.md#secrets-vault).
|
|
60
|
+
|
|
61
|
+
## Common tasks
|
|
62
|
+
|
|
63
|
+
### Access a variable in code
|
|
64
|
+
Prefer `applicationEnvironment.get()` over `process.env` directly - it stays in sync when secrets are hydrated from a vault.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { applicationEnvironment } from '@venizia/ignis-helpers';
|
|
68
|
+
import { EnvironmentKeys } from '@venizia/ignis';
|
|
61
69
|
|
|
70
|
+
const dbHost = applicationEnvironment.get<string>(EnvironmentKeys.APP_ENV_POSTGRES_HOST);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Add a per-environment file
|
|
62
74
|
```
|
|
63
75
|
project/
|
|
64
76
|
├── .env # Default (development)
|
|
@@ -67,14 +79,18 @@ project/
|
|
|
67
79
|
└── .env.example # Template (committed)
|
|
68
80
|
```
|
|
69
81
|
|
|
70
|
-
###
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
### Bypass startup validation during local prototyping
|
|
83
|
+
```bash
|
|
84
|
+
ALLOW_EMPTY_ENV_VALUE=true
|
|
85
|
+
```
|
|
86
|
+
Not recommended once real secrets are wired in - see [Validation](./environment-variables.md#validation).
|
|
73
87
|
|
|
74
|
-
|
|
88
|
+
### Look up every variable's default and requirement
|
|
89
|
+
See the [Environment Variables Reference](./environment-variables.md) for the full table, grouped by Application, Server, Database, Authentication, Logging, Storage, Mail, and Secrets & Vault.
|
|
75
90
|
|
|
76
|
-
##
|
|
91
|
+
## Reference
|
|
77
92
|
|
|
93
|
+
### EnvironmentKeys class
|
|
78
94
|
```typescript
|
|
79
95
|
import { EnvironmentKeys } from '@venizia/ignis';
|
|
80
96
|
```
|
|
@@ -82,7 +98,7 @@ import { EnvironmentKeys } from '@venizia/ignis';
|
|
|
82
98
|
| Constant | Description |
|
|
83
99
|
|----------|-------------|
|
|
84
100
|
| `APP_ENV_APPLICATION_NAME` | Application display name |
|
|
85
|
-
| `APP_ENV_APPLICATION_TIMEZONE` | Application timezone (e.g., 'Asia/Ho_Chi_Minh') |
|
|
101
|
+
| `APP_ENV_APPLICATION_TIMEZONE` | Application timezone (e.g., `'Asia/Ho_Chi_Minh'`) |
|
|
86
102
|
| `APP_ENV_APPLICATION_SECRET` | Application-wide secret key |
|
|
87
103
|
| `APP_ENV_JWT_SECRET` | JWT signing secret |
|
|
88
104
|
| `APP_ENV_JWT_EXPIRES_IN` | JWT token expiration |
|
|
@@ -92,8 +108,8 @@ import { EnvironmentKeys } from '@venizia/ignis';
|
|
|
92
108
|
| `APP_ENV_APPLICATION_DS_AUTHORIZE` | DataSource name for authorization |
|
|
93
109
|
| `APP_ENV_APPLICATION_DS_OAUTH2` | DataSource name for OAuth2 |
|
|
94
110
|
| `APP_ENV_OAUTH2_VIEW_FOLDER` | OAuth2 view templates folder |
|
|
95
|
-
| `APP_ENV_SERVER_HOST` | HTTP server host (e.g., '0.0.0.0') |
|
|
96
|
-
| `APP_ENV_SERVER_PORT` | HTTP server port (e.g., 3000) |
|
|
111
|
+
| `APP_ENV_SERVER_HOST` | HTTP server host (e.g., `'0.0.0.0'`) |
|
|
112
|
+
| `APP_ENV_SERVER_PORT` | HTTP server port (e.g., `3000`) |
|
|
97
113
|
| `APP_ENV_SERVER_BASE_PATH` | Base URL path prefix |
|
|
98
114
|
| `APP_ENV_DATASOURCE_NAME` | Default datasource name |
|
|
99
115
|
| `APP_ENV_POSTGRES_HOST` | PostgreSQL host |
|
|
@@ -102,11 +118,15 @@ import { EnvironmentKeys } from '@venizia/ignis';
|
|
|
102
118
|
| `APP_ENV_POSTGRES_PASSWORD` | PostgreSQL password |
|
|
103
119
|
| `APP_ENV_POSTGRES_DATABASE` | PostgreSQL database name |
|
|
104
120
|
|
|
105
|
-
|
|
121
|
+
## See also
|
|
106
122
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
- [Environment Variables Reference](./environment-variables.md) - complete variable list, defaults, and the Secrets & Vault section
|
|
124
|
+
- [Secrets & Vault Guide](/guides/core-concepts/secrets-vault) - setup walkthrough
|
|
125
|
+
- [Secrets & Vault Reference](/references/base/secrets) - full provider API
|
|
126
|
+
- [DataSources Guide](/guides/core-concepts/persistent/datasources) - wiring `APP_ENV_POSTGRES_*` into a DataSource
|
|
110
127
|
|
|
111
|
-
|
|
112
|
-
|
|
128
|
+
**Files:**
|
|
129
|
+
|
|
130
|
+
- [`packages/core-server/src/common/environments.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/common/environments.ts) - `EnvironmentKeys`
|
|
131
|
+
- [`packages/helpers/src/modules/env/app-env.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/env/app-env.ts) - `applicationEnvironment`, `Environment`, `ApplicationEnvironment`
|
|
132
|
+
- [`packages/core-server/src/base/applications/abstract.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/base/applications/abstract.ts) - `validateEnvs()`, host/port resolution
|
|
@@ -81,9 +81,8 @@ class GreeterController extends BaseGrpcController {
|
|
|
81
81
|
### BaseService
|
|
82
82
|
|
|
83
83
|
```typescript
|
|
84
|
-
import { BaseService
|
|
84
|
+
import { BaseService } from '@venizia/ignis';
|
|
85
85
|
|
|
86
|
-
@injectable({})
|
|
87
86
|
class UserService extends BaseService {
|
|
88
87
|
constructor() {
|
|
89
88
|
super({ scope: UserService.name });
|
|
@@ -308,17 +307,6 @@ const users = await userRepository.find({
|
|
|
308
307
|
|
|
309
308
|
## Dependency Injection
|
|
310
309
|
|
|
311
|
-
### Injectable Decorator
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
import { injectable } from '@venizia/ignis';
|
|
315
|
-
|
|
316
|
-
@injectable({})
|
|
317
|
-
class MyService extends BaseService {
|
|
318
|
-
// ...
|
|
319
|
-
}
|
|
320
|
-
```
|
|
321
|
-
|
|
322
310
|
### Inject Decorator
|
|
323
311
|
|
|
324
312
|
```typescript
|
|
@@ -368,7 +356,6 @@ import {
|
|
|
368
356
|
|
|
369
357
|
// DI
|
|
370
358
|
inject,
|
|
371
|
-
injectable,
|
|
372
359
|
|
|
373
360
|
// Utilities
|
|
374
361
|
jsonResponse,
|
|
@@ -513,7 +500,7 @@ if (Statuses.isCompleted(order.status)) {
|
|
|
513
500
|
|
|
514
501
|
```typescript
|
|
515
502
|
import {
|
|
516
|
-
|
|
503
|
+
AppErrorMiddleware,
|
|
517
504
|
notFoundHandler,
|
|
518
505
|
RequestSpyMiddleware,
|
|
519
506
|
emojiFavicon,
|
|
@@ -529,7 +516,7 @@ app.use(requestSpy.value());
|
|
|
529
516
|
app.use(emojiFavicon({ icon: '🚀' }));
|
|
530
517
|
|
|
531
518
|
// Error handling (register last)
|
|
532
|
-
app.onError(
|
|
519
|
+
app.onError(new AppErrorMiddleware({ logger: app.logger }).value());
|
|
533
520
|
|
|
534
521
|
// 404 handler
|
|
535
522
|
app.notFound(notFoundHandler({ logger: app.logger }));
|
|
@@ -1,98 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
:::
|
|
8
|
-
|
|
9
|
-
## `hash`
|
|
10
|
-
|
|
11
|
-
Creates a hash or HMAC digest of a string and returns it as a text-encoded string.
|
|
12
|
-
|
|
13
|
-
### Signature
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
hash(
|
|
17
|
-
text: string,
|
|
18
|
-
options: {
|
|
19
|
-
algorithm: 'SHA256' | 'MD5';
|
|
20
|
-
secret?: string;
|
|
21
|
-
outputType: BinaryToTextEncoding; // 'hex' | 'base64' | 'base64url' | 'latin1'
|
|
22
|
-
},
|
|
23
|
-
): string
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Parameters**
|
|
27
|
-
|
|
28
|
-
| Parameter | Type | Description |
|
|
29
|
-
|-----------|------|-------------|
|
|
30
|
-
| `text` | `string` | The input string to hash. |
|
|
31
|
-
| `options.algorithm` | `'SHA256' \| 'MD5'` | Hashing algorithm. |
|
|
32
|
-
| `options.secret` | `string` (optional) | Secret key for HMAC. Only used when `algorithm` is `'SHA256'`. |
|
|
33
|
-
| `options.outputType` | `BinaryToTextEncoding` | Encoding of the output string - typically `'hex'` or `'base64'`. |
|
|
1
|
+
---
|
|
2
|
+
title: Crypto Utility
|
|
3
|
+
description: Stateless MD5 and HMAC-SHA256 hashing built on node:crypto
|
|
4
|
+
difficulty: beginner
|
|
5
|
+
lastUpdated: 2026-07-16
|
|
6
|
+
---
|
|
34
7
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| Algorithm | `secret` provided | Result |
|
|
38
|
-
|-----------|-------------------|--------|
|
|
39
|
-
| `'MD5'` | ignored | MD5 digest of `text` |
|
|
40
|
-
| `'SHA256'` | yes | HMAC-SHA256 of `text` signed with `secret` |
|
|
41
|
-
| `'SHA256'` | no / `undefined` | `text` returned unchanged (no-op) |
|
|
42
|
-
| any other | - | `text` returned unchanged (no-op) |
|
|
43
|
-
|
|
44
|
-
The SHA256 pass-through is intentional: it lets callers skip hashing conditionally (for example, when a secret is not yet configured) without adding an extra `if` at the call site. If you need an unconditional SHA256 hash without a secret, use MD5 or the full [Crypto helper](/extensions/helpers/crypto/).
|
|
8
|
+
# Crypto Utility
|
|
45
9
|
|
|
46
|
-
|
|
10
|
+
A single stateless `hash` function for lightweight MD5 digests and HMAC-SHA256 signatures, with no external dependencies beyond Node's built-in `node:crypto`.
|
|
47
11
|
|
|
48
|
-
|
|
12
|
+
## In one example
|
|
49
13
|
|
|
50
14
|
```typescript
|
|
51
15
|
import { hash } from '@venizia/ignis-helpers';
|
|
52
16
|
|
|
53
17
|
const digest = hash('user@example.com', { algorithm: 'MD5', outputType: 'hex' });
|
|
54
18
|
// => 'b58996c504c5638798eb6b511e6f49af'
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**MD5 digest (base64) - useful for HTTP ETags**
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
const etag = hash(JSON.stringify(payload), { algorithm: 'MD5', outputType: 'base64' });
|
|
61
|
-
// => 'tYlsUExWOHeY62a1EW9Jr...'
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**HMAC-SHA256 - signing a webhook payload**
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
import { hash } from '@venizia/ignis-helpers';
|
|
68
19
|
|
|
69
20
|
const signature = hash(rawBody, {
|
|
70
21
|
algorithm: 'SHA256',
|
|
71
22
|
secret: process.env.WEBHOOK_SECRET,
|
|
72
23
|
outputType: 'hex',
|
|
73
24
|
});
|
|
74
|
-
|
|
75
|
-
// Compare against the value in the X-Hub-Signature-256 header
|
|
76
|
-
const expected = `sha256=${signature}`;
|
|
25
|
+
// Compare against the X-Hub-Signature-256 header: `sha256=${signature}`
|
|
77
26
|
```
|
|
78
27
|
|
|
79
|
-
|
|
28
|
+
## Functions
|
|
80
29
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
30
|
+
| Function | Signature | What it does |
|
|
31
|
+
|----------|-----------|---------------|
|
|
32
|
+
| `hash` | `hash(text: string, options: { algorithm: 'SHA256' \| 'MD5'; secret?: string; outputType: BinaryToTextEncoding }): string` | Creates an MD5 digest or an HMAC-SHA256 signature of `text`, encoded via `outputType` (`'hex'`, `'base64'`, `'base64url'`, `'latin1'`). |
|
|
33
|
+
|
|
34
|
+
## Behavior
|
|
35
|
+
|
|
36
|
+
| Algorithm | `secret` provided | Result |
|
|
37
|
+
|-----------|-------------------|--------|
|
|
38
|
+
| `'MD5'` | ignored | MD5 digest of `text` |
|
|
39
|
+
| `'SHA256'` | yes | HMAC-SHA256 of `text` signed with `secret` |
|
|
40
|
+
| `'SHA256'` | no / `undefined` | `text` returned unchanged (no-op) |
|
|
41
|
+
| any other value | - | `text` returned unchanged (no-op) |
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
|
|
45
|
+
- **The SHA256 pass-through is intentional.** It lets callers skip hashing conditionally (for example, when a secret is not yet configured) without an extra `if` at the call site.
|
|
46
|
+
- **Need an unconditional SHA256 hash with no secret?** Use `'MD5'`, or reach for the full [Crypto helper](/extensions/helpers/crypto/).
|
|
47
|
+
- **Typical uses:** cache keys or ETags from response bodies (MD5), webhook signature verification (HMAC-SHA256), API request signing (HMAC-SHA256), anonymising PII before logging (MD5).
|
|
48
|
+
- **Out of scope:** encryption, decryption, and asymmetric operations (AES, RSA, ECDH) - see the [Crypto helper](/extensions/helpers/crypto/) instead.
|
|
88
49
|
|
|
89
|
-
##
|
|
50
|
+
## See also
|
|
90
51
|
|
|
91
|
-
|
|
52
|
+
- [Crypto helper](/extensions/helpers/crypto/) - full AES / RSA / ECDH encryption
|
|
53
|
+
- [Utilities Overview](/references/utilities/) - all utility functions
|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
- Verifying webhook signatures (HMAC-SHA256)
|
|
95
|
-
- Signing API requests with a shared secret (HMAC-SHA256)
|
|
96
|
-
- Anonymising personally identifiable data before storing in logs (MD5)
|
|
55
|
+
**Files:**
|
|
97
56
|
|
|
98
|
-
|
|
57
|
+
- [`packages/helpers/src/utilities/crypto.utility.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/utilities/crypto.utility.ts)
|