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

confortable

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

confortable

Finds the right recursively placed config file

  • 0.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
360
increased by275%
Maintainers
1
Weekly downloads
 
Created
Source

Confortable Build Status

Confortable is a super lightweight config file selector/finder for nodejs. It will look at the execution cwd, and if no config matching the name is found, and the cwd is inside $HOME, it will keep going up one directory until it hits $HOME. Example usage can be seen in logule. and combustion.

It does not parse the config, and thus does not enforce any structure upon the config file itself. It simply returns the best path || null.

Usage

Basic usage:

var conf = require('confortable');
confPath = conf('.confName'); // if non-null, this can be read by fs or required if js compatible

Optionally, a start directory (if cwd isn't sufficient) can be specified for the search start:

var confPath = require('confortable')('.combustion', templateDir);

A final optional setting is a fallback directory, in case the recursive search fails, but you still want to see if a config exists somewhere else (like say the path of the parent module). In this use case, you have to specify the start as well.

var fallback = require('path').dirname(module.parent.filename);
var confPath = require('confortable')('.logule', process.cwd(), fallback);
```

## Installation

````bash
$ npm install conf

Running tests

Install development dependencies

$ npm install

Run the tests

$ npm test

License

MIT-Licensed. See LICENSE file for details.

Keywords

FAQs

Package last updated on 20 Aug 2012

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