JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7217
  • Score
    100M100P100Q152482F
  • License MIT

Spring Cloud Config Client for NodeJS

Package Exports

  • cloud-config-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cloud-config-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Spring Cloud Config Client for NodeJS

Build Status

Requires: NodeJS 4+

Feature requests are welcome.

Install

npm install cloud-config-client --save

Usage

const client = require("cloud-config-client");
client.load({
    application: "invoices"
}).then((config) => {
    // Look for a key
    const value1 = config.get("this.is.a.key");

    // Using a prefix, this is equivalent to .get("this.is.another.key");
    const value2 = config.get("this.is", "another.key");
});

load function

const promise = client.load(options);
// or
client.load(options, function(error, cfg) { ... });

Parameters:

  • options (object, mandatory):
    • endpoint (string, optional, default: http://localhost:8888): Config server URL
    • application (deprecated: use name): Load configuration for this app
    • name (string, mandatory): Load the configuration with this name
    • profiles (string array, optional, default: ["default"])
    • label (string, optional)
    • auth (object, optional): Basic Authentication for access config server (e.g.: { user: "username", pass: "password"}). endpoint accepts also basic auth (e.g. http://user:pass@localhost:8888)
      • user (string)
      • pass (string)
  • cb (function, optional): node style callback, if missing the method will return a promise.

Returns a configuration object, use get method to query values.

References