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

config_okay

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config_okay

Make sure config files are mode 0600 before you use it

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

config okay

This became a module because I used it more than once.

It is really simple. All it does is parse a config file. Borrowing from postgresql, it refuses to do anything if the config file isn't chmod 0600. I don't even know what that means in the Windows or Mac world, so patches welcome. Essentially, if a file is not set such that only the owner can read and write it, then it isn't a good idea to store passwords in it.

So, if you have a config file of any sort, and it is set to be chmod 0600, then you can use this file.

What is does is check the permissions of the file, then it requires it and returns the results of the require statement.

According to the node.js docs, require will pull in either a javascript file, or a JSON file.

Installation

npm install config_okay

Example


var config_okay = require('config_okay')
var configfile = 'config.json' // or pull from the command line or something

config_okay(configfile,function(err,config){
     if(err){
        throw new Error('node.js needs a good croak module')
     }
     do_something(config)
})

Personally, I sometimes stick this in something like an async.waterfall as the first function in the sequence, so that if it fails, the whole cascade will abort.

Keywords

FAQs

Package last updated on 06 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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