Skip to content

Commit

Permalink
fix: Resolving overwritten system variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsteele committed Jul 24, 2017
1 parent 4b44ddb commit 2e2d8b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Dotenv {
}

Object.keys(blueprint).map(key => {
const value = (env[key] || env[key] === '') ? env[key] : vars[key]
const value = vars.hasOwnProperty(key) ? vars[key] : env[key]
if (!value && options.safe) {
throw new Error(`Missing environment variable: ${key}`)
} else {
Expand Down
4 changes: 2 additions & 2 deletions test/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ function runTests (Obj, name) {
PATH.should.contain('/')
})

it('should allow local variables to override systemvars', () => {
envTest({path: envSystemvars, systemvars: true})['process.env.PATH'].should.equal('""')
it('should not allow local variables to override systemvars', () => {
envTest({path: envSystemvars, systemvars: true})['process.env.PATH'].should.not.equal('""')
})
})

Expand Down

0 comments on commit 2e2d8b2

Please sign in to comment.