New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

env-config

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-config - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.npmignore

4

package.json
{
"name": "env-config",
"description": "parse configuration options from environment variables",
"description": "read configuration from environment variables",
"author": "Maximilian Krüger <kruemaxi@googlemail.com> (http://github.com/snd)",
"version": "0.1.0",
"version": "0.2.0",
"repository": {

@@ -7,0 +7,0 @@ "type": "git",

@@ -1,11 +0,23 @@

# Env Config
# Env config
read [configuration](http://www.12factor.net/config) from environment variables.
read [config](http://www.12factor.net/config) from environment variables.
### Install
npm install https://github.com/snd/env-config.git
npm install env-config
### Use
given some environment variables:
```
MY_PROJECT_PORT=8080
MY_PROJECT_MYSQL_USER=foo
MY_PROJECT_MYSQL_PASSWORD=bar
MY_PROJECT_LOG_INFO=true
MY_PROJECT_PROVISION_RATE=0.2
```
use them in your application:
```coffeescript

@@ -20,12 +32,4 @@ envConfig = require 'env-config'

environment =
PROJECT_NAME_PORT: '8080'
PROJECT_NAME_MYSQL_USER: 'foo'
PROJECT_NAME_MYSQL_PASSWORD: 'bar'
PROJECT_NAME_LOG_INFO: 'true'
console.log envConfig 'MY_PROJECT', specification, process.env
config = envConfig 'PROJECT_NAME_', specification, environment
console.log config
# => {

@@ -35,8 +39,9 @@ # port: 8080,

# mysqlPassword: 'bar',
# logInfo: true
# logInfo: true
# provisionRate: 0.2
# }
```
### License
`envConfig` throws an exception if an environment variable is empty or can't be converted to the specified type.
MIT
### License: MIT

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc