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
Requires: NodeJS 4+
Feature requests are welcome.
Install
npm install cloud-config-client --saveUsage
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 URLapplication(deprecated: use name): Load configuration for this appname(string, mandatory): Load the configuration with this nameprofiles(string array, optional, default:["default"])label(string, optional)auth(object, optional): Basic Authentication for access config server (e.g.:{ user: "username", pass: "password"}).endpointaccepts 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.