node-consul-service 1.0.48 → 1.0.50
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/consul/client.d.ts +1 -0
- package/dist/index.cjs.js +9 -2
- package/dist/index.esm.js +9 -3
- package/package.json +1 -1
package/dist/consul/client.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export interface ConsulClientOptions {
|
|
|
4
4
|
port?: number;
|
|
5
5
|
secure?: boolean;
|
|
6
6
|
}
|
|
7
|
+
export declare function toBoolean(value?: string | boolean | null): boolean;
|
|
7
8
|
export declare function initClient({ host, port, secure, }: ConsulClientOptions): void;
|
|
8
9
|
export declare function getClient(): Consul;
|
package/dist/index.cjs.js
CHANGED
|
@@ -15,12 +15,18 @@ var events = require('events');
|
|
|
15
15
|
|
|
16
16
|
// src/lib/client.ts
|
|
17
17
|
let consulClient = null;
|
|
18
|
+
function toBoolean(value) {
|
|
19
|
+
if (typeof value === "boolean")
|
|
20
|
+
return value;
|
|
21
|
+
if (typeof value === "string")
|
|
22
|
+
return value.toLowerCase() === "true";
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
18
25
|
function initClient({ host = "127.0.0.1", port = 8500, secure = false, }) {
|
|
19
|
-
console.log("🚀 ~ secure:", secure, typeof secure);
|
|
20
26
|
consulClient = new Consul({
|
|
21
27
|
host: host !== null && host !== void 0 ? host : "127.0.0.1",
|
|
22
28
|
port: port !== null && port !== void 0 ? port : 8500,
|
|
23
|
-
secure:
|
|
29
|
+
secure: toBoolean(secure),
|
|
24
30
|
});
|
|
25
31
|
consulClient.agent.self((err) => {
|
|
26
32
|
if (err) {
|
|
@@ -19181,4 +19187,5 @@ exports.getServiceUrl = getServiceUrl;
|
|
|
19181
19187
|
exports.initClient = initClient;
|
|
19182
19188
|
exports.listServices = listServices;
|
|
19183
19189
|
exports.registerService = registerService;
|
|
19190
|
+
exports.toBoolean = toBoolean;
|
|
19184
19191
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.esm.js
CHANGED
|
@@ -13,12 +13,18 @@ import { EventEmitter } from 'events';
|
|
|
13
13
|
|
|
14
14
|
// src/lib/client.ts
|
|
15
15
|
let consulClient = null;
|
|
16
|
+
function toBoolean(value) {
|
|
17
|
+
if (typeof value === "boolean")
|
|
18
|
+
return value;
|
|
19
|
+
if (typeof value === "string")
|
|
20
|
+
return value.toLowerCase() === "true";
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
16
23
|
function initClient({ host = "127.0.0.1", port = 8500, secure = false, }) {
|
|
17
|
-
console.log("🚀 ~ secure:", secure, typeof secure);
|
|
18
24
|
consulClient = new Consul({
|
|
19
25
|
host: host !== null && host !== void 0 ? host : "127.0.0.1",
|
|
20
26
|
port: port !== null && port !== void 0 ? port : 8500,
|
|
21
|
-
secure:
|
|
27
|
+
secure: toBoolean(secure),
|
|
22
28
|
});
|
|
23
29
|
consulClient.agent.self((err) => {
|
|
24
30
|
if (err) {
|
|
@@ -19168,5 +19174,5 @@ async function dataLink(data, schema) {
|
|
|
19168
19174
|
return isArray ? result : result[0];
|
|
19169
19175
|
}
|
|
19170
19176
|
|
|
19171
|
-
export { DataLinkError, callService, dataLink, deregisterService, getClient, getRandomServiceInstance, getServiceInstances, getServiceUrl, initClient, listServices, registerService };
|
|
19177
|
+
export { DataLinkError, callService, dataLink, deregisterService, getClient, getRandomServiceInstance, getServiceInstances, getServiceUrl, initClient, listServices, registerService, toBoolean };
|
|
19172
19178
|
//# sourceMappingURL=index.esm.js.map
|