0

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

2
  • Check for stray whitespace characters before Twitter: Commented Feb 24, 2013 at 13:51
  • @Plynx There is no whitespace Commented Feb 24, 2013 at 14:13

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Try using it like this

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

Does this give any errors ?

2 Comments

var Twitter = require('config').Twitter; Gives error. It says that Twitter is undefined
I have the same issue, I wonder if there is any resolution on this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.