From 7359de1875b97f7785ed5b4b9d8e14d5d482208f Mon Sep 17 00:00:00 2001 From: mikob Date: Tue, 12 May 2015 18:44:58 -0400 Subject: [PATCH] Added kue-dashboard script for conveniently running the dashboard as a standalone application without creating a new script. --- Readme.md | 11 ++++++++++- bin/kue-dashboard | 21 +++++++++++++++++++++ package.json | 3 ++- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 bin/kue-dashboard diff --git a/Readme.md b/Readme.md index 8bede82a..a658dc7d 100755 --- a/Readme.md +++ b/Readme.md @@ -604,7 +604,16 @@ var q = kue.createQueue({ ## User-Interface -The UI is a small [Express](http://github.com/visionmedia/express) application, to fire it up simply run the following, altering the port etc as desired. +The UI is a small [Express](http://github.com/visionmedia/express) application. +A script is provided in `bin/` for running the interface as a standalone application +with default settings. You may pass in options for the port and redis-url. For example: + +``` +node_modules/kue/bin/kue-dashboard -p 3050 -r redis://127.0.0.1:3000 +``` + +You can fire it up from within another application too: + ```js var kue = require('kue'); diff --git a/bin/kue-dashboard b/bin/kue-dashboard new file mode 100755 index 00000000..2b9a8ec6 --- /dev/null +++ b/bin/kue-dashboard @@ -0,0 +1,21 @@ +#!/usr/bin/env node +var kue = require('kue'); +var argv = require('yargs') + .usage('Usage: $0 [options]') + .example('$0 -p 3050 -r redis://10.0.0.4:6379') + .describe('r', 'Redis url') + .describe('p', 'Dashboard port') + .default('p', 3000) + .default('r', 'redis://127.0.0.1:6379') + .help('h') + .alias('h', 'help') + .argv +; + +kue.createQueue({ + redis: argv.r +}); + + +kue.app.listen(argv.p); +console.log("Running on 127.0.0.1:" + argv.p); diff --git a/package.json b/package.json index 387df9cb..0e9a8976 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "node-redis-warlock": "^0.1.2", "redis": "~0.12.0", "reds": "~0.2.5", - "stylus": "0.42.2" + "stylus": "0.42.2", + "yargs": "^3.9.0" }, "devDependencies": { "async": "^0.9.0",