首页 > 移动平台 > 详细

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

时间:2018-07-11 19:10:34      阅读:190      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!