zoukankan      html  css  js  c++  java
  • [Node.js] Setup Local Configuration with Node.js Applications

    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');
  • 相关阅读:
    第三章函数
    基本数据类型
    gulp压缩js
    read/load
    jQuery的类数组对象结构
    立即调用表达式
    npm
    cocos2d.js
    图片上传后压缩 Thinkphp
    判断用户是否在微信中
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9296043.html
Copyright © 2011-2022 走看看