@midwayjs/consul 3.9.9 → 3.10.0

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.
@@ -39,19 +39,17 @@ let ConsulConfiguration = class ConsulConfiguration {
39
39
  if (this.shouldBeRegisterMe) {
40
40
  config.name = config.name || app.getProjectName();
41
41
  config.id = config.id || `${config.name}:${address}:${port}`;
42
- config.check =
43
- config.check ||
44
- (config.check === false
45
- ? void 0
46
- : app.getFrameworkType() === core_1.MidwayFrameworkType.WEB
47
- ? {
48
- http: `http://${address}:${port}/consul/health/self/check`,
49
- interval: '3s',
50
- }
51
- : {
52
- tcp: `${address}:${port}`,
53
- interval: '3s',
54
- });
42
+ if (!config.check && config.check !== false) {
43
+ config.check = ['egg', 'koa', 'express'].includes(app.getNamespace())
44
+ ? {
45
+ http: `http://${address}:${port}/consul/health/self/check`,
46
+ interval: '3s',
47
+ }
48
+ : {
49
+ tcp: `${address}:${port}`,
50
+ interval: '3s',
51
+ };
52
+ }
55
53
  Object.assign(this.consulRegisterConfig, config);
56
54
  // 把原始的 consul 对象注入到容器
57
55
  container.registerObject('consul:consul', this.consulProvider.getConsul());
@@ -6,7 +6,7 @@ class ConsulProvider {
6
6
  constructor(providerOptions) {
7
7
  // should be, ignore config
8
8
  providerOptions.promisify = true;
9
- this.consul = Consul(providerOptions);
9
+ this.consul = new Consul(providerOptions);
10
10
  }
11
11
  getConsul() {
12
12
  return this.consul;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/consul",
3
3
  "description": "midway consul",
4
- "version": "3.9.9",
4
+ "version": "3.10.0",
5
5
  "main": "dist/index",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -10,15 +10,15 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "devDependencies": {
13
- "@midwayjs/core": "^3.9.0",
14
- "@midwayjs/koa": "^3.9.9",
15
- "@midwayjs/mock": "^3.9.0",
13
+ "@midwayjs/core": "^3.10.0",
14
+ "@midwayjs/koa": "^3.10.0",
15
+ "@midwayjs/mock": "^3.10.0",
16
16
  "@types/consul": "0.40.0",
17
17
  "@types/sinon": "10.0.13",
18
- "nock": "13.2.9"
18
+ "nock": "13.3.0"
19
19
  },
20
20
  "dependencies": {
21
- "consul": "^0.40.0"
21
+ "consul": "1.2.0"
22
22
  },
23
23
  "keywords": [
24
24
  "consul"
@@ -39,5 +39,5 @@
39
39
  "type": "git",
40
40
  "url": "https://github.com/midwayjs/midway.git"
41
41
  },
42
- "gitHead": "95bb5b3f23b41f685372c45d1c3bb12a3e31b4e0"
42
+ "gitHead": "33d28f1a020963404488e866432916fd15c0952c"
43
43
  }