Permalink
Browse files

Improved readme, added package.json

  • Loading branch information...
indutny committed Sep 14, 2010
1 parent 54427e6 commit b0597ff42938c70f387ee3f1eae307473943eba1
Showing with 26 additions and 4 deletions.
  1. +0 −1 README
  2. +1 −0 README.rdoc
  3. +1 −0 app.balancer
  4. +0 −1 config.json
  5. +0 −1 index.js
  6. +1 −1 lib/balancer/index.js
  7. +1 −0 node-balancer
  8. +22 −0 package.json
View
1 README
@@ -1 +0,0 @@
-More info soon...
View
@@ -0,0 +1 @@
+===Installation npm install balancer===UsageFrom console: node-balancer [config-file] By default [config-file] = ./app.balancer Config file must contain valid JSON object Example config: { "servers" : [ "127.0.0.1:8080", "127.0.0.1:8081" ], "addr" : "127.0.0.1:80", "spread" : {, "include": ".*", "exclude": "\\\\.json$" } } "servers" - servers list "addr" - balancer address "spread" - balancer can spread request to random server use this option to configure rules of spread "include", "exclude" - should contain RegExp
View
@@ -0,0 +1 @@
+{ "servers": [ "localhost:8080", "localhost:8081", "localhost:8082", "localhost:8083", "localhost:8084", "localhost:8085", "localhost:8086", "localhost:8087", "localhost:8088", "localhost:8089" ], "addr": "192.168.0.100:80", "spread": { "include": ".*", "exclude": "new|update|talk" }}
View
@@ -1 +0,0 @@
-{ "servers": [ "localhost:8080", "localhost:8081", "localhost:8082" ], "addr": "localhost:8079", "spread": { "include": ".*", "exclude": "new|update|talk" }}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1 @@
+#!/usr/bin/env nodevar fs = require('fs'), sys = require('sys'), Balancer = require('./lib/balancer').Balancer, argv = process.argv.slice(2), filename = './app.balancer';filename = argv[0] || filename; function help() { sys.puts('Help:'); sys.puts('node-balancer [config-file]'); sys.puts('By default [config-file] = ./app.balancer'); sys.puts(''); sys.puts('Config file must contain valid JSON object'); sys.puts(''); sys.puts('Example config:'); sys.puts('{'); sys.puts(' "servers" : ['); sys.puts(' "127.0.0.1:8080",'); sys.puts(' "127.0.0.1:8081"'); sys.puts(' ],'); sys.puts(' "addr" : "127.0.0.1:80",'); sys.puts(' "spread" : {,'); sys.puts(' "include": ".*",'); sys.puts(' "exclude": "\\\\.json$"'); sys.puts(' }'); sys.puts('}'); sys.puts(''); sys.puts('"servers" - servers list'); sys.puts('"addr" - balancer address'); sys.puts('"spread" - balancer can spread request to random server'); sys.puts(' use this option to configure rules of spread'); sys.puts(' "include", "exclude" - should contain RegExp');}if (filename === '-h' || filename === '--help') { help(); return;} fs.readFile(filename, function(err, data) { if (err) { help(); return; } var config; try { config = JSON.parse(data); } catch (e) { throw Error(filename + ' is not valid JSON file (' + e +')'); } Balancer(config);});process.on('uncaughtException', function(e) { sys.puts('Balancer caught exception: ' + e);});
View
@@ -0,0 +1,22 @@
+{
+ "name" : "Balancer",
+ "description" : "Load Balancer for node.js (supports WebSockets)",
+ "url" : "http://github.com/donnerjack13589/node-balancer",
+ "keywords" : ["load balancer", "balancer", "websocket"],
+ "author" : "Fedor Indutny <fedor.indutny@gmail.com>",
+ "contributors" : [
+ {name: "Fedor Indutny", email: "fedor.indutny@gmail.com"}
+ ],
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/donnerjack13589/balancer.git"
+ },
+ "version" : "0.2.0",
+ "engines" : { "node": ">=0.2" },
+ "directories": {
+ "lib": "./lib"
+ },
+ "bin": {
+ "node-balancer" : "./node-balancer"
+ }
+}

0 comments on commit b0597ff

Please sign in to comment.