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; }