码迷,mamicode.com
首页 > 移动开发 > 详细

[Node.js] Setup Local Configuration with Node.js Applications

时间:2018-07-11 19:47:04      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:conf   RoCE   dea   change   mat   ini   tar   username   file   

Github

To stop having to change configuration settings in production code and to stop secure information like usernames and password being stored in source control its 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 are present and how you might communicate an example configuration file to other team members.

 

const dotenv = require(‘dotenv‘).config({ path: ‘variables.env‘ });
const colors = require(‘colors‘);
const setup = require(‘./setup‘);
// run setup, to access anything from variables.env, you only need process.env.USER
try{
    setup.init()
}catch(err){
    console.error(`Critical Error - Server Stoppping ${err}`);
    process.exit();
}


console.log(
‘Server Started‘);

 

[Node.js] Setup Local Configuration with Node.js Applications

标签:conf   RoCE   dea   change   mat   ini   tar   username   file   

原文地址:https://www.cnblogs.com/Answer1215/p/9296043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!