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

sails-js-hook-dotenv

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-js-hook-dotenv - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

CHANGELOG.md

41

index.js

@@ -1,4 +0,4 @@

dotenv = require('dotenv');
dotenv = require('dotenv')
module.exports = function(sails) {
module.exports = function (sails) {

@@ -8,26 +8,33 @@ return {

defaults: {
__configKey__: {
active: true,
throwOnFailure: true,
},
},
active: true
initialize: function (cb) {
if (!sails.config[this.configKey].active) {
sails.log.verbose('Dotenv hook deactivated.')
return cb()
}
},
initialize: function(cb) {
const result = dotenv.config()
if (!sails.config[ this.configKey ].active) {
// dotenv config failed to load
if (result.error) {
sails.log.verbose('Dotenv hook deactivated.');
return cb();
if (sails.config[this.configKey].throwOnFailure) {
throw result.error
} else {
sails.config[this.configKey].active = false
sails.log.verbose('Dotenv hook deactivated.')
}
return cb()
}
dotenv.config();
return cb();
return cb()
},
};
};
}
}
{
"name": "sails-js-hook-dotenv",
"version": "1.0.0",
"version": "1.0.1",
"description": "Sails.js hook for loading .env files",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,3 +18,23 @@ # sails-hook-dotenv

You can add configuration options for this hook in `config/dotenv.js` by default. Currently, the only option is a boolean: `active`. Setting this to false will disable this hook.
```js
module.exports.dotenv = {
default: {
/**
* Setting this to false will disable this hook
*/
active: true,
/**
* Setting this to false will cause the application
* NOT to throw an error if the config fails to load
*/
throwOnFailure: true,
}
}
```
### Testing

@@ -25,1 +45,5 @@

Then run `npm run test` in your terminal.
### Changelog
[Changelog](CHANGELOG.md)
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