Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tylerlh/tinyconf
Simple, env-specific config loader for node.js
https://github.com/tylerlh/tinyconf
Last synced: about 2 months ago
JSON representation
Simple, env-specific config loader for node.js
- Host: GitHub
- URL: https://github.com/tylerlh/tinyconf
- Owner: TylerLH
- License: mit
- Created: 2014-04-19T20:41:25.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-20T22:37:19.000Z (over 10 years ago)
- Last Synced: 2024-08-09T07:07:53.041Z (5 months ago)
- Language: JavaScript
- Size: 156 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
tinyconf
========Simple, env-specific config loader for node.js. Uses JSON files for config settings.
## Usage
Install tinyconf via NPM: `npm install --save tinyconf`Create a config folder in your project containing JSON files using your app's environments (`process.env.NODE_ENV`) for filenames:
```Bash
mkdir ./config && cd ./config
touch development.json staging.json production.json
```Development JSON example (./config/development.json):
```JSON
{
"socket_path": "http://localhost:3000",
"port": 3001
}
```Then require tinyconf in your app and you're good to go:
```Coffeescript
# app.coffee
config = require('tinyconf')()
express = require 'express'
app = express()
io = require('socket.io-client')
socket = io.connect config.socket_pathsocket.on 'connect', ->
socket.emit 'status', msg: "Initializing"app.listen(config.port || 3001)
```### Options
**path** - Set an optional path to your config folder. If not set, tinyconf assumes your config folder is in the same directory as your app.
Example: `var config = require('tinyconf')({path: './another_dir/config'});`