Socket
Socket
Sign inDemoInstall

clever-discovery

Package Overview
Dependencies
0
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.8 to 0.0.9

__tests__/discovery.test.ts

34

package.json
{
"name": "clever-discovery",
"version": "0.0.8",
"version": "0.0.9",
"description": "Node client library for service discovery",
"main": "index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "make test"
"build": "tsc --dist",
"test": "jest"
},
"jest": {
"moduleFileExtensions": [
"js",
"jsx",
"json",
"ts",
"tsx"
],
"testRegex": "/__tests__/.+\\.ts$",
"transform": {
"^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
}
},
"repository": {

@@ -20,4 +35,15 @@ "type": "git",

"devDependencies": {
"mocha": "^2.3.2"
"@types/jest": "^18.1.1",
"@types/node": "^10.12.0",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"babel-eslint": "^7.1.1",
"eslint": "5.x",
"eslint-config-airbnb": "^6.2.0",
"eslint-plugin-react": "^4.2.3",
"jest": "^18.1.0",
"prettier": "1.18.2",
"ts-jest": "^18.0.3",
"typescript": "^3.2.1"
}
}

36

README.md
# discovery-node
This library programmatically finds endpoints for dependencies. Similar to [discovery-go](https://github.com/Clever/discovery-go) and [disocvery-python](https://github.com/Clever/discovery-python).
This library programmatically finds endpoints for dependencies. Similar to [discovery-go](https://github.com/Clever/discovery-go) and [discovery-python](https://github.com/Clever/discovery-python).
See [Service Discovery](https://github.com/Clever/infra-docs/blob/master/deploy/service_discovery.md) for more details.
See [Service Discovery](https://clever.atlassian.net/wiki/spaces/ENG/pages/116686857/Discovery) for more details.

@@ -17,13 +17,13 @@ ## API

### install and import
### Install and import
```bash
npm install --save @clever/discovery
npm install --save clever-discovery
```
```coffee
discovery = require "@clever/discovery"
discovery = require "clever-discovery"
```
### examples
### Examples

@@ -34,23 +34,7 @@ ```coffee

disc_stoked = discovery("stoked", "thrift")
try stoked_host = disc_stoked.host() catch err then cb(err)
try stoked_port = disc_stoked.port() 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)
```
## Implementation Details
Currently, `discovery-{go,node,python}` looks for environment variables with the following format:
```
SERVICE_{SERVICE_NAME}_{EXPOSE_NAME}_{PROTO,HOST,PORT}
```
These environment variables are autogenerated by [fab](http://github.com/Clever/fabulaws) and [catapult](http://github.com/Clever/catapult) during app deployment. Three env-vars are created for each app listed in the `dependencies` section of caller's launch yaml.
For example, if an app lists `district-authorizations` as a dependency, fab and catapult will generate this env-vars triplet:
```bash
SERVICE_DISTRICT_AUTHORIZATIONS_HTTP_PROTO = "http"
SERVICE_DISTRICT_AUTHORIZATIONS_HTTP_HOST = "district-authorizations.ops.clever.com"
SERVICE_DISTRICT_AUTHORIZATIONS_HTTP_PORT = "80"
```
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.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc