Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

service-url-finder

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

service-url-finder

Get the URL for a service from the environment, either through Docker or overrides.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

service-url-finder Build Status

Get the URL for a service from the environment, either through Docker or overrides.

Installation

npm install --save service-url-finder

Usage

export REDIS_URL=redis://my.redis.host:6379
var serviceUrlFinder = require('service-url-finder'):
console.log(serviceUrlFinder('redis', 6379)); // "redis://my.redis.host:6379"

Signature

function serviceUrlFinder(name, defaultPort, defaultHost, defaultProtocol) { ... }

Behavior

service-url-finder first checks process.env for an environment variable named SERVICE_NAME_URL and returns that.

If none is found, it checks for environment variables of the type Docker sets with links (i.e., SERVICE_NAME_PORT_999_TCP) and tries those.

Finally, it generates a string based on defaults that either you supply or it infers.

So assuming no environment variables, the call serviceUrlFinder('something-cool', 9999) will return something-cool://127.0.0.1:9999.

License

ISC.

Keywords

service

FAQs

Package last updated on 02 Apr 2015

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