Update eureka-js-client to 4.4 typing

This commit is contained in:
Karl J. Overå
2018-12-05 16:41:39 +01:00
parent e1a9b84984
commit 2ef5b8cb2d
2 changed files with 32 additions and 3 deletions
@@ -19,3 +19,27 @@ const client = new Eureka({
port: 32768,
}
});
// example configuration against newer Eureka (https://www.npmjs.com/package/eureka-js-client#400-bad-request-errors-from-eureka-server)
const newerClient = new Eureka({
// application instance information
instance: {
app: 'jqservice',
hostName: 'localhost',
ipAddr: '127.0.0.1',
port: {
$: 443,
'@enabled': true
},
vipAddress: 'jq.test.something.com',
dataCenterInfo: {
'@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo',
name: 'MyOwn',
},
},
eureka: {
// eureka server host / port
host: '192.168.99.100',
port: 32768,
}
});
+8 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for eureka-js-client 4.3
// Type definitions for eureka-js-client 4.4
// Project: https://github.com/jquatier/eureka-js-client
// Definitions by: Ilko Hoffmann <https://github.com/Schnillz>
// Definitions by: Ilko Hoffmann <https://github.com/Schnillz>, Karl O. <https://github.com/karl-run>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class Eureka {
@@ -26,7 +26,7 @@ export namespace EurekaClient {
ipAddr: string;
vipAddress: string;
dataCenterInfo: DataCenterInfo;
port?: number;
port?: number | LegacyPortWrapper;
instanceId?: string;
appGroupName?: string;
sid?: string;
@@ -61,6 +61,10 @@ export namespace EurekaClient {
useLocalMetadata?: boolean;
preferIpAddress?: boolean;
}
interface LegacyPortWrapper {
'$': number;
'@enabled': boolean;
}
interface PortWrapper {
enabled: boolean;
port: number;
@@ -71,5 +75,6 @@ export namespace EurekaClient {
}
interface DataCenterInfo {
name: DataCenterName;
'@class'?: string;
}
}