Comparing version 3.0.0-rc1 to 3.0.0-rc2
@@ -8,5 +8,12 @@ const https = require('https'); | ||
const LOCALENV = 'local'; | ||
const LOCALPORT = process.env.STDLIB_LOCAL_PORT || 8170; | ||
module.exports = (cfg, names, params, callback) => { | ||
cfg = cfg || {}; | ||
cfg = Object.keys(cfg).reduce((ncfg, key) => { | ||
ncfg[key] = cfg[key]; | ||
return ncfg | ||
}, {}); | ||
cfg.host = cfg.host || HOST; | ||
@@ -22,5 +29,9 @@ cfg.port = cfg.port || PORT; | ||
let pathname = cfg.debug ? | ||
names.slice(3).join('/') : | ||
names.slice(0, 2).join('/') + names.slice(2).join('/') | ||
if (names[2] === `@${LOCALENV}`) { | ||
cfg.host = 'localhost'; | ||
cfg.port = LOCALPORT; | ||
names[2] = ''; | ||
} | ||
let pathname = names.slice(0, 2).join('/') + names.slice(2).join('/'); | ||
pathname = pathname + '/'; | ||
@@ -27,0 +38,0 @@ let headers = {}; |
{ | ||
"name": "lib", | ||
"version": "3.0.0-rc1", | ||
"version": "3.0.0-rc2", | ||
"description": "StdLib: Standard Library for Microservices Node.js Bindings", | ||
@@ -5,0 +5,0 @@ "main": "lib.js", |
@@ -87,17 +87,2 @@ # StdLib Node.js Bindings | ||
### Local Usage | ||
To use StdLib services locally (from within a StdLib function), use the | ||
"string composition" method and begin your service path with a period; | ||
```javascript | ||
lib['.otherFunction']({key: 'X'}, (err, result) => {}); | ||
``` | ||
This functionality exists, so if needs be, you can directly interface with | ||
other functions within a StdLib service when testing locally (i.e. MapReduce | ||
usage). Please note that **local functions always execute in the same context | ||
and thread as the caller**, meaning you *will not* get the scalability benefits | ||
of calling the function remotely, however **latency is significantly reduced**. | ||
## Additional Information | ||
@@ -104,0 +89,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302
15489
95
6