@tcinema-pro/common 1.1.0 → 1.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/dist/grpc/grpc.module.js
CHANGED
|
@@ -39,6 +39,7 @@ const common_1 = require("@nestjs/common");
|
|
|
39
39
|
const grpc_registry_1 = require("./grpc.registry");
|
|
40
40
|
const grpc_factory_1 = require("./grpc.factory");
|
|
41
41
|
const grpc_constants_1 = require("./grpc.constants");
|
|
42
|
+
const config_1 = require("@nestjs/config");
|
|
42
43
|
let GrpcModule = (() => {
|
|
43
44
|
let _classDecorators = [(0, common_1.Module)({})];
|
|
44
45
|
let _classDescriptor;
|
|
@@ -62,16 +63,16 @@ let GrpcModule = (() => {
|
|
|
62
63
|
const cfg = grpc_registry_1.grpcRegistry[token];
|
|
63
64
|
return {
|
|
64
65
|
provide: `${grpc_constants_1.GRPC_CLIENT_PREFIX}_${token}`,
|
|
65
|
-
useFactory: (factory) => {
|
|
66
|
+
useFactory: (factory, configService) => {
|
|
66
67
|
const client = factory.createClient({
|
|
67
68
|
package: cfg.package,
|
|
68
69
|
protoPath: cfg.protoPath,
|
|
69
|
-
url: cfg.url,
|
|
70
|
+
url: configService.getOrThrow(cfg.url),
|
|
70
71
|
});
|
|
71
72
|
factory.register(`${grpc_constants_1.GRPC_CLIENT_PREFIX}_${token}`, client);
|
|
72
73
|
return client;
|
|
73
74
|
},
|
|
74
|
-
inject: [grpc_factory_1.GrpcClientFactory],
|
|
75
|
+
inject: [grpc_factory_1.GrpcClientFactory, config_1.ConfigService],
|
|
75
76
|
};
|
|
76
77
|
}),
|
|
77
78
|
],
|
|
@@ -6,16 +6,16 @@ exports.grpcRegistry = {
|
|
|
6
6
|
ACCOUNT_PACKAGE: {
|
|
7
7
|
package: 'account.v1',
|
|
8
8
|
protoPath: contracts_1.PROTO_PATHS.ACCOUNT,
|
|
9
|
-
url: '
|
|
9
|
+
url: 'AUTH_GRPC_URL',
|
|
10
10
|
},
|
|
11
11
|
AUTH_PACKAGE: {
|
|
12
12
|
package: 'auth.v1',
|
|
13
13
|
protoPath: contracts_1.PROTO_PATHS.AUTH,
|
|
14
|
-
url: '
|
|
14
|
+
url: 'AUTH_GRPC_URL',
|
|
15
15
|
},
|
|
16
16
|
USERS_PACKAGE: {
|
|
17
17
|
package: 'users.v1',
|
|
18
18
|
protoPath: contracts_1.PROTO_PATHS.USERS,
|
|
19
|
-
url: '
|
|
19
|
+
url: 'USERS_GRPC_URL',
|
|
20
20
|
},
|
|
21
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tcinema-pro/common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Common core shared components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@nestjs/common": "^11.1.16",
|
|
29
|
+
"@nestjs/config": "^4.0.3",
|
|
29
30
|
"@nestjs/microservices": "^11.1.16",
|
|
30
31
|
"@tcinema-pro/contracts": "^1.2.2"
|
|
31
32
|
}
|