really easy to use config object, extends with underscore
Super simple config module that allows you to easily share some config options for your application with a few helpers. I wrote this because I needed something fairly static for my express sub applications.
I am still fairly regularly breaking, refactoring and perfecting my universal strategy to making one simple config file... to rule them all. (jk, if i wanted that i wouldn't have written this in coffeescript right? :neckbeard:)
var Config = ;var options =title: "Some example title"db_path: "test"port: 1337init: false;var config = moduleexports = options;
If your options object looks like this:
title: "Some example title"db_path: "test"port: 1337init: false
Your output would be:
title: "Some example title"protocol: "http://"host: "127.0.0.1"port: 1337uri: ""db_connection: "mongodb://127.0.0.1:27017"db_path: "test"db_uri: "mongodb://127.0.0.1:27017/test"init: false
Stores your config data to
config.json, so you can load your app with that instead of this module. I use it for client setups, so when they deploy their application I don't need to worry about a db being down, or this module not building.
config.jsonin the path specified
Useful when you have access to the
req object in express.js
ip- client ip, not the server/router ip
req.userexists it stores it to this
engine- application uri
Creates folders easily so you don't have to deal with
.placeholder or alike workarounds
Helpful when dealing with a lot of
Keeps your sensitive stuff in a prototype and grabs from
process.env.NODE_PASS defaults inside source
Deprecated, planning on destroying this soon.
If you're building a lot of express apps this binds the title and port, more coming soon..
The MIT License (MIT)Copyright (c) 2013 David HigginbothamPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.