Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6897665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:11:52+00:00 2026-05-27T07:11:52+00:00

I am using node.js + express.js + everyauth.js. I have moved all my everyauth

  • 0

I am using node.js + express.js + everyauth.js. I have moved all my everyauth logic into a module file

var login = require('./lib/everyauthLogin');

inside this I load my oAuth config file with the key/secret combinations:

var conf = require('./conf');
.....
twitter: {
    consumerKey: 'ABC', 
    consumerSecret: '123'
}

These codes are different for different environments – development / staging / production as the callbacks are to different urls.

Question: How do I set these in the environmental config to filter through all modules or can I pass the path directly into the module?

Set in env:

app.configure('development', function(){
  app.set('configPath', './confLocal');
});

app.configure('production', function(){
  app.set('configPath', './confProduction');
});

var conf = require(app.get('configPath'));

Pass in

app.configure('production', function(){
  var login = require('./lib/everyauthLogin', {configPath: './confProduction'});
});

? hope that makes sense

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:11:52+00:00Added an answer on May 27, 2026 at 7:11 am

    My solution,

    load the app using

    NODE_ENV=production node app.js
    

    Then setup config.js as a function rather than an object

    module.exports = function(){
        switch(process.env.NODE_ENV){
            case 'development':
                return {dev setting};
    
            case 'production':
                return {prod settings};
    
            default:
                return {error or other settings};
        }
    };
    

    Then as per Jans solution load the file and create a new instance which we could pass in a value if needed, in this case process.env.NODE_ENV is global so not needed.

    var Config = require('./conf'),
        conf = new Config();
    

    Then we can access the config object properties exactly as before

    conf.twitter.consumerKey
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a http server using node js var sys = require(sys), http
I am creating node.js app using express, everyauth and now.js. I have a server-side
I'm using node, express and connect for a simple app and have basic HTTP
I start to look at Node.js. Also I'm using Express. And I have a
I'm using Node.JS and Express web framework, I have a problem with the res.render()
I'm using Node.js together with Express framework and i18n module . So I use
I have a Node.js Express app that I'm hosting on Nodejitsu. I'm already using
I have the following XPATH line: //det[@nItem=1]/prod/cProd That successfully selects the desired node using
I am using express (web framework for node.js) with ejs. Now I'd like to
I'm using Node.js and trying to render an EJS template file. I figured out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.