node-rsc
v0.0.5
Published
Really Simple Content Rscuration control for production node deployments
Downloads
12
Maintainers
Readme
RSC - Really Simple Content RSCR - Really Simple Content Routing
VISIONS
- Really simple content is distributed thru a routing as embedable HTML
** ex. rsc__get("afelia.logo") => "/img/ico/afelia.png"
** ex. rsc__getLogo("afelia","html") => <img src=/img/ico/afelia.png class="rsc_logo afelia.logo">
** ex. rsc__getLogo("main","html") => <img src=/img/ico/afelia.png class="rsc_logo afelia.logo">
** ex. rsc__getLogo ("afelia","html",false) => <img src=http://afelia.jgwill.com/img/ico/afelia.png class="rsc_logo afelia.logo">
** ex. rsc__getLogo ("","html",false) => <img src=http://afelia.jgwill.com/img/ico/afelia.png class="rsc_logo afelia.logo">
ACTIONS
** A Prototype
- A package Fork compatible as base
Reality
//a file ./rsc/default.json
var rsc = require('node-rsc');
var cnf = rsc.get("Logos");
console.log(cnf.test);
{
"Logos": {
"test": "myval"
}
}
Introduction
Node-rsc organizes hierarchical rscurations for your app deployments.
It lets you define a set of default parameters, and extend them for different deployment environments (development, qa, staging, production, etc.).
Rscurations are stored in rscuration files within your application, and can be overridden and extended by environment variables, command line parameters, or external sources.
This gives your application a consistent rscuration interface shared among a growing list of npm modules also using node-rsc.
Project Guidelines
- Simple - Get started fast
- Powerful - For multi-node enterprise deployment
- Flexible - Supporting multiple rsc file formats
- Lightweight - Small file and memory footprint
- Predictable - Well tested foundation for module and app developers
Quick Start
The following examples are in JSON format, but rscurations can be in other file formats.
Install in your app directory, and edit the default rsc file.
$ npm install rsc
$ mkdir rsc
$ vi rsc/default.json
{
// Customer module rscs
"Customer": {
"dbRsc": {
"host": "localhost",
"port": 5984,
"dbName": "customers"
},
"credit": {
"initialLimit": 100,
// Set low for development
"initialDays": 1
}
}
}
Edit rsc overrides for production deployment:
$ vi rsc/production.json
{
"Customer": {
"dbRsc": {
"host": "prod-db-server"
},
"credit": {
"initialDays": 30
}
}
}
Use rscs in your code:
var rsc = require('rsc');
//...
var dbRsc = rsc.get('Customer.dbRsc');
db.connect(dbRsc, ...);
if (rsc.has('optionalFeature.detail')) {
var detail = rsc.get('optionalFeature.detail');
//...
}
rsc.get()
will throw an exception for undefined keys to help catch typos and missing values.
Use rsc.has()
to test if a rscuration value is defined.
Start your app server:
$ export NODE_ENV=production
$ node my-app.js
Running in this rscuration, the port
and dbName
elements of dbRsc
will come from the default.json
file, and the host
element will
come from the production.json
override file.
Articles
- Rscuration Files
- Common Usage
- Environment Variables
- Reserved Words
- Command Line Overrides
- Multiple Node Instances
- Sub-Module Rscuration
- Rscuring from a DB / External Source
- Securing Production Rsc Files
- External Rscuration Management Tools
- Examining Rscuration Sources
- Using Rsc Utilities
- Upgrading from Rsc 0.x
- Webpack usage
Further Information
If you still don't see what you are looking for, here more resources to check:
- The wiki may have more pages which are not directly linked from here.
- Review questions tagged with node-rsc on StackExchange. These are monitored by
node-rsc
contributors. - Search the issue tracker. Hundreds of issues have already been discussed and resolved there.
Contributors
License
May be freely distributed under the MIT license.
Copyright (c) 2010-2018 Loren West and other contributors