Selvaraj M A
Selvaraj M A

Reputation: 3136

configuration using node config module

I am using the config module in node js. Under config/default.yaml, I have following configuration

Facebook:
    appKey: ""
    appSecret: ""

Twitter:
    consumerKey: ""
    consumerSecret: ""

When I use require('config'), the returned object only contains Facebook. No Twitter. Any idea? I am totally cluless

Upvotes: 0

Views: 262

Answers (2)

Selvaraj M A
Selvaraj M A

Reputation: 3136

After some research, I landed here. https://github.com/lorenwest/node-config/issues/27

Seems like if we use yaml, then we should declare js-yaml in our dependency list and that solved my problem.

Upvotes: 2

user568109
user568109

Reputation: 48003

Try using it like this

var Facebook = require('config').Facebook;
var Twitter = require('config').Twitter;

Does this give any errors ?

Upvotes: 0

Related Questions