node-env-file
Advanced tools
Comparing version 0.1.0 to 0.1.2
@@ -75,8 +75,10 @@ 'user strict'; | ||
lines.forEach(function(line) { | ||
if (!/\#/i.test(line)) { // ignore comment lines (starting with #). | ||
var key_value = line.split(/\s*\=\s*/); | ||
if (!/^\s*\#/i.test(line)) { // ignore comment lines (starting with #). | ||
var key_value = line.match(/^([^=]+)\s*=\s*(.+)$/); | ||
var env_key = key_value[0]; | ||
var env_value = key_value[1]; | ||
var env_key = key_value[1]; | ||
// remove ' and " characters if right side of = is quoted | ||
var env_value = key_value[2].match(/^(['"]?)([^\n]*)\1$/m)[2]; | ||
// overwrite already defined `process.env.*` values? | ||
@@ -83,0 +85,0 @@ if (!!options.overwrite) { |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["process", "env", "file", "files", ".env", "ENV", "process.env", "parse", "load", "export", "exports"], | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/grimen/node-env-file", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -136,1 +136,3 @@ # NODE-ENV-FILE [![Build Status](https://secure.travis-ci.org/grimen/node-env-file.png)](http://travis-ci.org/grimen/node-env-file) | ||
Copyright (c) [Jonas Grimfelt](http://github.com/grimen) | ||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/grimen/node-env-file/trend.png)](https://bitdeli.com/free "Bitdeli Badge") |
@@ -168,2 +168,18 @@ var helper = require('./helper'), | ||
'("./fixtures/.env.3")': function () { | ||
expect(function() { | ||
env(__dirname + '/fixtures/.env.3'); | ||
}).to.not.throw(Error); | ||
expect(process.env.FOO).to.be.equal('http://foo.com?bar=baz'); | ||
}, | ||
'("./fixtures/.env.4")': function () { | ||
expect(function() { | ||
env(__dirname + '/fixtures/.env.4'); | ||
}).to.not.throw(Error); | ||
expect(process.env.FOO).to.be.equal('http://foo.com#hash?bar=baz'); | ||
}, | ||
'("./fixtures/.env.exports.0")': function () { | ||
@@ -266,2 +282,10 @@ expect(function() { | ||
expect(process.env.QUX).to.be.equal(undefined); | ||
}, | ||
'("./fixtures/.env.exports.3")': function () { | ||
expect(function() { | ||
env(__dirname + '/fixtures/.env.exports.3'); | ||
}).to.not.throw(Error); | ||
expect(process.env.FOO).to.be.equal('http://foo.com?bar=baz'); | ||
} | ||
@@ -268,0 +292,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20131
27
359
138
122