From f84aa174d369d100e9252d8c89d7480e089c74ff Mon Sep 17 00:00:00 2001 From: Alex Robsahm Date: Mon, 16 Jan 2017 20:08:21 +0100 Subject: [PATCH] Updated getConfig and Readme --- README.md | 4 ++-- index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 47faa58..76dc688 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Initiate config fetching. `environment` is one of "dev", "stage" or "prod" ``` var configClient = require("next-config-client"); -configClient({ +configClient.initializeConfigUpdate({ requestUrl: "ws://example.com/api/vx/config/", environment: "dev" }) @@ -12,4 +12,4 @@ configClient({ // Do stuff with config and start app }); ``` -After that use `configClient.config` to get the latest config +After that use `configClient.getConfig(["part", "key"], defaultValue)` to get the config value you need. diff --git a/index.js b/index.js index 26e7bad..548026a 100644 --- a/index.js +++ b/index.js @@ -43,8 +43,8 @@ const initializeConfigUpdate = (conf) => { return new Promise(connect); }; -const getConfig = ([part, key], def) => { - const confValue = R.path(part + '.' + key, config) +const getConfig = (path, def) => { + const confValue = R.path(path, config); if (confValue !== undefined) { return confValue; }