@@ -58,7 +58,7 @@ type Keypath : String | Array<String>
5858
5959zero-config := (dirname: String, opts?: {
6060 argv?: Array<String>,
61- dc ?: String,
61+ dcValue ?: String,
6262 blackList?: Array<String>,
6363 env?: Object<String, String>,
6464 seed?: Object<String, Any>,
@@ -133,15 +133,14 @@ If you require `fetchConfig` anywhere else like `./api/server.js`
133133** Note** that ` opts ` is only optional in environments other then
134134 ` "production ` ". If your ` process.env.NODE_ENV ` is set to
135135 ` "production" ` then you ** MUST** specifiy ` opts ` and specify
136- the ` opts.dc ` parameter.
136+ the ` opts.dcValue ` parameter.
137137
138138Running a production service without knowing how to load
139139 datacenter specific configuration is a bug.
140140
141- #### ` opts.dc `
141+ #### ` opts.dcValue `
142142
143- ` opts.dc ` is either ` null ` or a string path to a file that
144- contains the name of the datacenter.
143+ ` opts.dcValue ` is either ` null ` or a datacenter name.
145144
146145Say you have two datacenters, EC2-west and EC2-east. It's
147146 recommended that you have a file called ` /etc/datacenter `
@@ -150,6 +149,9 @@ Say you have two datacenters, EC2-west and EC2-east. It's
150149This way any service can know what datacenter it is running
151150 in with a simple ` cat /etc/datacenter ` .
152151
152+ You can then call ` fetchConfig(...) ` with the datacenter value
153+ by calling ` fs.readFileSync('/etc/datacenter') `
154+
153155Note that if you pass the dc config to ` fetchConfig ` then the
154156 config object will contain the ` "datacenter" ` key whose value
155157 is either ` EC2-west ` or ` EC2-east ` or whatever your datacenter
0 commit comments