[node. js] Setup Local Configuration with node. JS applications

Source: Internet
Author: User

Github

To stop has to change the configuration settings in production code and to the stop secure information like usernames and PASSW Ord being stored in source control it a good idea-to-use local configuration files.

This lesson explains how to read in the local configuration, how to perform a check to make sure the required variables AR E present and how are you might communicate a example configuration file to other team members.

Const DOTENV = require (' dotenv '). config ({path: ' variables.env '  }); = Require (' colors '= require ('./setup '); // run Setup, to access anything from variables.env, need Process.env.USER Try {    setup.init ()}catch(err) {    - Server stoppping ${err} ');    Process.exit ();}

console.log (
' Server Started ');

[node. js] Setup Local Configuration with node. JS applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.