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

konfup

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

konfup

Nodejs configuration made easy

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Konfup Build Status

Nodejs configuration made easy.

Konfup is an environment and configuration loader. A few things to note are the .env file must always be located at the root directory, the config can be loaded via a name of a json file located at the root or a path to the config file in any directory.

Quickstart

Install the module from npm as shown.

npm install konfup

An environment file .env located at the root file may be shown as below

NODE_ENV=dev
PORT=9001
BASIC=basic
S3_KEY=jasgday28y3r98ya0u0f9usg0sdfjh98y
S3_SECRET=kjhashdou20u09ueh00senfs0udfkaguy9e

A configuration file named settings.json located at the root may be as shown below

{
  "name": "Your application name",
  "database": {
    "host": "localhost",
    "port": 27012,
    "user": "root",
    "pass": "pass",
    "name": "database"
  }
}

Thats it. To use the environment and config, just use the following two lines shown below.

var express = require('express');
var konf = require('konfup');
var config = konf.env().config('settings');

var app = express();

// use the config object as follows
var db = config.database.name

// use the env variables as follows
app.listen(process.env.port);

Alternatively you could use the boot function to load both env and config. Its a wrapper to run these two functions.

var konf = require('konfup');
var config = konf.boot('settings');

License

Do Whatever The Fuck You Want License (DWTFYT)

Copyright (c) 2014 Whoever uses it.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation, to use it ("Software") without restriction. You are free to copy, modify merge, publish distribute, sublicense and/or sell copies of the Software.

THE SOFTWARE IS PROVIDED WITHOUT ANY WARRANTY OF ANY KIND. THE AUTHOR IS NOT RESPONSIBLE FOR ANY EVENT OR DAMAGES THAT THE LIBRARY MIGHT CAUSE, AND ARENT LIABLE FOR ANY CLAIM.

Cheers !!

Keywords

FAQs

Package last updated on 11 Nov 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