Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dotenv

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

.env.production

7

lib/main.js

@@ -9,5 +9,6 @@ "use strict";

version: package_json.version,
environment: process.env.NODE_ENV || "development",
keys_and_values: {},
environment: function() {
return process.env.NODE_ENV || dotenv.keys_and_values["NODE_ENV"] || "development"
},
_loadEnv: function() {

@@ -17,3 +18,3 @@ return dotenv._getKeysAndValuesFromEnvFilePath(".env");

_loadEnvDotEnvironment: function() {
return dotenv._getKeysAndValuesFromEnvFilePath(".env."+dotenv.environment);
return dotenv._getKeysAndValuesFromEnvFilePath(".env."+dotenv.environment());
},

@@ -20,0 +21,0 @@ _getKeyAndValueFromLine: function(line) {

{
"name": "dotenv",
"version": "0.2.7",
"version": "0.2.8",
"description": "Loads environment variables from .env",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

@@ -23,3 +23,3 @@ # dotenv

...
"dotenv": "0.2.7"
"dotenv": "0.2.8"
}

@@ -26,0 +26,0 @@ }

@@ -14,3 +14,3 @@ var assert = require('assert'),

it('version should be set', function() {
result.version.should.eql("0.2.7");
result.version.should.eql("0.2.8");
});

@@ -45,8 +45,8 @@

it('reads from .env.development', function() {
process.env.FROM_DEVELOPMENT_ENV.should.eql("from_development_env");
it('reads from .env.staging', function() {
process.env.FROM_STAGING_ENV.should.eql("from_staging_env");
});
it('overrides any values in .env with .env.environment', function() {
process.env.ENVIRONMENT_OVERRIDE.should.eql("development");
process.env.ENVIRONMENT_OVERRIDE.should.eql("staging");
});

@@ -80,5 +80,31 @@

process.env.ENVIRONMENT_OVERRIDE.should.eql("set_on_machine");
delete process.env.ENVIRONMENT_OVERRIDE; //clean up for other tests
});
});
describe('.load() if NODE_ENV is set in .env', function() {
before(function() {
result.load();
});
it('ENVIRONMENT_OVERRIDE should equal the value set in the .env.staging', function() {
process.env.ENVIRONMENT_OVERRIDE.should.eql('staging');
delete process.env.NODE_ENV; //cleanup for other tests
delete process.env.ENVIRONMENT_OVERRIDE;
});
});
describe('.load() if NODE_ENV is set in .env but NODE_ENV is already set on machine', function() {
before(function() {
process.env.NODE_ENV = "development"
result.load();
});
it('ENVIRONMENT_OVERRIDE should equal the value set in the .env.development because that is the environment being set by the machine. machine wins here.', function() {
process.env.ENVIRONMENT_OVERRIDE.should.eql('development');
delete process.env.NODE_ENV; //clean up for other tests
delete process.env.ENVIRONMENT_OVERRIDE;
});
});
describe('.parse()', function(){

@@ -85,0 +111,0 @@ it('should return an object', function(){

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