🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

clever-discovery

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clever-discovery

Node client library for service discovery

1.2.3
latest
Source
npm
Version published
Maintainers
0
Created
Source

discovery-node

This library programmatically finds endpoints for dependencies. Similar to discovery-go and discovery-python.

See Service Discovery for more details.

API

  • disc = discovery(<service>, <interface>)

    • disc.proto() - returns the service protocol
    • disc.host() - returns the hostname or ip
    • disc.port() - returns the port
    • disc.host_port() - returns (<host>:<port>)
    • disc.proto_host() - returns (<proto>://<host>)
    • disc.url() - returns the url (<proto>://<host>:<port>)
  • external_url(<url>) - returns the external url to use

Install and import

npm install --save clever-discovery
import { discovery, external_url } from "clever-discovery"

Examples

disc_gearman = discovery("gearman-admin", "http")
try gearman_url = disc_gearman.url() catch err then cb(err)

disc_systemic = discovery("systemic", "thrift")
try systemic_host = disc_systemic.host() catch err then cb(err)
try systemic_port = disc_systemic.port() catch err then cb(err)

try clever_com_url = external_url("clever.com") catch err then cb(err)

To see what interfaces a Clever service exposes, check its launch yaml. You should see one or more exposes listed, and the name of the expose is used as the interface value in the discovery client.

FAQs

Package last updated on 02 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts