web-app-runner
Advanced tools
Comparing version 0.90.27 to 0.90.28
@@ -88,11 +88,18 @@ /** | ||
/** | ||
* shutdown middleware. | ||
* @param request | ||
* @param response | ||
* @param next | ||
*/ | ||
this.shutdown = function(request, response, next) { | ||
var method = request.method, | ||
url = request.url, | ||
ip = request.ip, | ||
msg = 'shutting down from pid: ' + process.pid; | ||
var visitor = request.visitor, | ||
url = visitor.url, | ||
ip = visitor.ip, | ||
method = visitor.method, | ||
msg = [ 'shutting down from pid: ', process.pid, '\n' ].join(''); | ||
log.info('shutdown request from ip: ', ip, ', url: ', url); | ||
if (ip === '127.0.0.1' && url === '/shutdown' && method === 'POST') { | ||
log.info('shutdown request from ip: ', ip, ', url: ', url); | ||
if (url === '/shutdown') { | ||
response.writeHead(200, { | ||
@@ -108,3 +115,2 @@ 'Content-Length': msg.length, | ||
} else { | ||
log.info('no shutdown...'); | ||
next(); | ||
@@ -118,3 +124,3 @@ } | ||
this.stop = function() { | ||
if (app) { | ||
if (connection) { | ||
log.info('closing connection...'); | ||
@@ -156,2 +162,3 @@ connection.close(); | ||
args.shift(); | ||
if (args[ 1 ] === childKey) { | ||
@@ -158,0 +165,0 @@ server.start(); |
{ | ||
"name": "web-app-runner", | ||
"version": "0.90.27", | ||
"version": "0.90.28", | ||
"description": "A simple HTTP application server that accepts or rejects connections based on authenticated attributes including ip, user agent, etc. The server can be used stand alone or as middleware for connect or express.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -26,2 +26,4 @@ # Web App Runner | ||
require('web-app-runner').createInstance().start(); | ||
It's easy to stop this server--just hit ctrl-c. | ||
@@ -42,3 +44,3 @@ ### Basic Server | ||
runner.start(); | ||
runner.start(); | ||
@@ -75,2 +77,8 @@ ### Production Web Server | ||
You can stop this server from the local host by doing this: | ||
curl -d token=<appkey> http://127.0.0.1:<port>/shutdown | ||
Where appkey is defined in options and the port is the current listening port. Alternatively, you can find the PID by looking in the logs and send a kill signal (-2 or -9). | ||
#### Dynamic Configuration Example | ||
@@ -202,2 +210,2 @@ | ||
- - - | ||
<p><small><em>Copyright © 2014, rain city software | Version 0.90.27</em></small></p> | ||
<p><small><em>Copyright © 2014, rain city software | Version 0.90.28</em></small></p> |
@@ -58,2 +58,11 @@ /** | ||
describe('shutdown', function() { | ||
it('should reject a shutdown request from non-local host ip'); | ||
it('should issue a shutdown and stop from a local host ip'); | ||
}); | ||
describe('stop', function() { | ||
it('should close an open connection'); | ||
}); | ||
describe('landingPageRouter', function() { | ||
@@ -60,0 +69,0 @@ it('should read the index page and write to mock response'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51778
25
763
208
5