@midwayjs/consul 3.11.12 → 3.11.15
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/configuration.d.ts +1 -1
- package/dist/configuration.js +3 -3
- package/package.json +6 -6
package/dist/configuration.d.ts
CHANGED
|
@@ -23,6 +23,6 @@ export declare class ConsulConfiguration implements ILifeCycle {
|
|
|
23
23
|
*/
|
|
24
24
|
registerConsul(container: IMidwayContainer, app: IMidwayApplication): Promise<void>;
|
|
25
25
|
onServerReady(container: IMidwayContainer, app?: IMidwayApplication): Promise<void>;
|
|
26
|
-
onStop(
|
|
26
|
+
onStop(): Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=configuration.d.ts.map
|
package/dist/configuration.js
CHANGED
|
@@ -36,6 +36,8 @@ let ConsulConfiguration = class ConsulConfiguration {
|
|
|
36
36
|
async registerConsul(container, app) {
|
|
37
37
|
const config = this.consulRegisterConfig;
|
|
38
38
|
const { address, port } = this.consulRegisterConfig;
|
|
39
|
+
// 把原始的 consul 对象注入到容器
|
|
40
|
+
container.registerObject('consul:consul', this.consulProvider.getConsul());
|
|
39
41
|
if (this.shouldBeRegisterMe) {
|
|
40
42
|
config.name = config.name || app.getProjectName();
|
|
41
43
|
config.id = config.id || `${config.name}:${address}:${port}`;
|
|
@@ -51,15 +53,13 @@ let ConsulConfiguration = class ConsulConfiguration {
|
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
Object.assign(this.consulRegisterConfig, config);
|
|
54
|
-
// 把原始的 consul 对象注入到容器
|
|
55
|
-
container.registerObject('consul:consul', this.consulProvider.getConsul());
|
|
56
56
|
await this.consulProvider.registerService(this.consulRegisterConfig);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
async onServerReady(container, app) {
|
|
60
60
|
await this.registerConsul(container, app);
|
|
61
61
|
}
|
|
62
|
-
async onStop(
|
|
62
|
+
async onStop() {
|
|
63
63
|
if (this.consulProviderConfig.register &&
|
|
64
64
|
this.consulProviderConfig.deregister) {
|
|
65
65
|
const { id } = this.consulRegisterConfig;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/consul",
|
|
3
3
|
"description": "midway consul",
|
|
4
|
-
"version": "3.11.
|
|
4
|
+
"version": "3.11.15",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@midwayjs/core": "^3.11.
|
|
14
|
-
"@midwayjs/koa": "^3.11.
|
|
15
|
-
"@midwayjs/mock": "^3.11.
|
|
13
|
+
"@midwayjs/core": "^3.11.15",
|
|
14
|
+
"@midwayjs/koa": "^3.11.15",
|
|
15
|
+
"@midwayjs/mock": "^3.11.15",
|
|
16
16
|
"@types/consul": "0.40.0",
|
|
17
17
|
"@types/sinon": "10.0.15",
|
|
18
|
-
"nock": "13.3.
|
|
18
|
+
"nock": "13.3.2"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"consul": "1.2.0"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"type": "git",
|
|
40
40
|
"url": "https://github.com/midwayjs/midway.git"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "a4054247f3b9f4fc8ba51684c002606d849e0bd3"
|
|
43
43
|
}
|