clever-discovery
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"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" | ||
} | ||
} |
# 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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
13778
12
224
0
12
39
2