New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

env-loador

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-loador

Read the environment variables in the specified configuration file and set them to the current application, and run the specified script.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

ENV-LOADOR

读取指定配置文件中的环境变量并设置到当前应用程序中,并运行指定的脚本。

解决了什么问题?

很多时候,在开发机上的配置我们不需要同步到git上,以前设置环境变量是设置到package.json,但这个文件不会加入到.gitignore,有一些机密设置会一不小心就同步到网上。

该项目将变量设置项存储于指定的配置文件中,你可以将该文件加入到.gitignore中,避免被同步到网上。

怎么使用?

安装

npm install --save env-loador

配置

package.jsonscripts中添加配置项,如:

{
  "name": "demo",
  "version": "0.0.1",
  "description": "",
  "main": "lib/index.js",
  "scripts": {
    "dev": "env-loador node index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

参数

只有一个参数--file,通过该参数可以设置环境变量配置所在的位置。如:env-loador --file ./.env node index.js,默认情况下,变量存储于./env.json文件中。

怎么配置变量

参考文件env.json

FAQs

Package last updated on 11 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts