nodejs-config icon indicating copy to clipboard operation
nodejs-config copied to clipboard

Inability to specify name of config folder

Open jameswomack opened this issue 10 years ago • 2 comments

Thank you for open sourcing this module.

A few comments:

  1. It would be more useful and fit better within the Node community if you allowed the user to override the name of the config folder
  2. It would be more intuitive to longtime Node programmers if process.env.NODE_ENV was the default. That is the environment value almost all popular modules use and is considered a best practice
  3. In your README, it's unclear how your environment configuration object works. Is it specifying the machine names that, if matching the current machine, will indicate which environment the app will consider itself to be in?

I'm interested in using this module for a Netflix project if the above two changes were made. I'd be happy to open a pull request.

jameswomack avatar Mar 17 '15 17:03 jameswomack

Hi James,

Thanks for your interest in this module and valuable comments.

  1. I will update this module with this enhancement soon when once I get a time slot(Pull requests are welcome).

  2. One of the main speciality of this module is it's environment detection mechanism. It detects the environment based on the current machine's name it running with. This module doesn't force users to use a fixed mechanism provided by the module to determine the development environment. As I wrote in readme If you need more flexible environment detection, you may pass a function to the configuration setup method, allowing you to implement environment detection however you wish. As you said if you want to use process.env.NODE_ENV as your environment, you can achieve like this:

    var config = require('nodejs-config')(
       __dirname,  // an absolute path to your applications 'config' directory
       function()
       {
          return process.env.NODE_ENV;
       }
    );
    
  3. Yes, exactly like that.

Feel free to get in touch, if you need any help with this module.

Thanks.

harishanchu avatar Mar 19 '15 18:03 harishanchu

Thank you @harishanchu

jameswomack avatar Mar 23 '15 07:03 jameswomack