@@ -53,16 +53,21 @@ You can also call the process with
5353### ` var config = fetchConfig(dirname, opts) `
5454
5555``` ocaml
56- playdoh-server/config := (dirname: String, opts?: {
56+ type Keypath : String | Array<String>
57+
58+ zero-config := (dirname: String, opts?: {
5759 argv?: Array<String>,
5860 dc?: String,
5961 blackList?: Array<String>,
6062 env?: Object<String, String>,
6163 seed?: Object<String, Any>
6264}) => {
63- get: (keypath?: String) => Any,
64- set: (keypath: String, value: Any) => void,
65- __state: Object<String, Any>
65+ get: (keypath?: Keypath) => Any,
66+ set: ((keypath: Keypath, value: Any) => void) &
67+ (value: Any) => void,
68+ getRemote: (keypath?: Keypath) => Any,
69+ setRemote: ((keypath: Keypath, value: Any) => void) &
70+ (value: Any) => void
6671}
6772```
6873
@@ -214,6 +219,33 @@ You can call `config.set("port", 9001)` to set the port value.
214219 You can call ` config.set("playdoh-logger.kafka.port", 9001) ` to
215220 set then nested kafka port config option.
216221
222+ Note you can also call ` config.set(entireObject) ` to merge an
223+ entire object into the ` config ` instance. This will use
224+ deep extend to set all the key / value pairs in ` entireObject `
225+ onto the config instance.
226+
227+ #### ` var value = config.getRemote(keypath) `
228+
229+ The same as ` config.get() ` but gets from a different in memory
230+ object then ` config.get() ` .
231+
232+ It's recommended that you use ` config.get() ` and ` config.set() `
233+ for any local configuration that is static and effectively
234+ immutable after process startup.
235+
236+ You can use ` config.getRemote() ` and ` config.setRemote() ` for
237+ any dynamic configuration that is effectively controlled
238+ remotely outside your program.
239+
240+ #### ` config.setRemote(keypath, value) `
241+
242+ The same as ` config.set() ` but sets to a different in memory
243+ objec then ` config.set() ` .
244+
245+ You can use ` config.getRemote() ` and ` config.setRemote() ` for
246+ any dynamic configuration that is effectively controlled
247+ remotely outside your program.
248+
217249## Installation
218250
219251` npm install zero-config `
0 commit comments