@nimbus-cqrs/utils 2.1.1 → 2.1.2
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 +7 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Refer to the [Nimbus main repository](https://github.com/overlap-dev/Nimbus) or
|
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
# Deno
|
|
16
|
-
deno add
|
|
16
|
+
deno add npm:@nimbus-cqrs/utils
|
|
17
17
|
|
|
18
18
|
# NPM
|
|
19
19
|
npm install @nimbus-cqrs/utils
|
|
@@ -31,13 +31,13 @@ For detailed documentation, please refer to the [Nimbus documentation](https://n
|
|
|
31
31
|
`getEnv` reads a list of environment variables from `process.env` and returns them as a plain object. If any of the requested variables are missing it logs the missing names through the Nimbus logger and throws a `GenericException`, so misconfiguration fails loudly at startup instead of leaking through as `undefined` later.
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
import { getEnv } from
|
|
34
|
+
import { getEnv } from "@nimbus-cqrs/utils";
|
|
35
35
|
|
|
36
36
|
const env = getEnv({
|
|
37
|
-
variables: [
|
|
37
|
+
variables: ["MONGO_URI", "MONGO_DB_NAME"],
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
console.log(env.MONGO_URI);
|
|
40
|
+
console.log(env.MONGO_URI); // "mongodb://localhost:27017"
|
|
41
41
|
console.log(env.MONGO_DB_NAME); // "my-app"
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -56,11 +56,11 @@ If, for example, `MONGO_DB_NAME` is not set, the call throws a `GenericException
|
|
|
56
56
|
A typical pattern is to call `getEnv` once at application startup, before any subsystem that needs those values is initialized:
|
|
57
57
|
|
|
58
58
|
```typescript
|
|
59
|
-
import { getEnv } from
|
|
60
|
-
import { MongoConnectionManager } from
|
|
59
|
+
import { getEnv } from "@nimbus-cqrs/utils";
|
|
60
|
+
import { MongoConnectionManager } from "@nimbus-cqrs/mongodb";
|
|
61
61
|
|
|
62
62
|
const env = getEnv({
|
|
63
|
-
variables: [
|
|
63
|
+
variables: ["MONGO_URI", "MONGO_DB_NAME"],
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
const mongo = new MongoConnectionManager({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbus-cqrs/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Simplify Event-Driven Applications - Utility helpers shared across the Nimbus framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nimbus",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@opentelemetry/api": "^1.9.1",
|
|
35
35
|
"zod": "^4.3.6",
|
|
36
|
-
"@nimbus-cqrs/core": "^2.1.
|
|
36
|
+
"@nimbus-cqrs/core": "^2.1.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^22.0.0"
|