Skip to content

Commit

Permalink
REFACTORING: Register as a new user (closes #28).
Browse files Browse the repository at this point in the history
The static pages and rewriting to CouchDB `_users` 
database are no more served by a CouchDB app
but by AAAforREST itself. Additional settings and 
installing are no more required.

A virtual server (`auth.*`) is always on for this.
  • Loading branch information
benel committed May 17, 2015
1 parent 259c8d5 commit 9a17934
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,3 @@ Installation procedure
* The service can be stopped with:

sudo forever stop app/proxy.js

* The (optional) Web interface can be installed in CouchDB with:

curl -X PUT -d '"false"' localhost:5984/_config/httpd/secure_rewrites
couchapp push --browse db http://localhost:5984/aaaforrest
11 changes: 10 additions & 1 deletion app/proxy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var app = require('express')();
var express = require('express');
var vhost = require('vhost');
var proxy = require('express-http-proxy');
var http = require('http');
var url = require('url');
var async = require('async');
Expand Down Expand Up @@ -232,6 +234,13 @@ function parseHttpCredentials(context) {
}
}

var userApp = express.Router();
userApp.use(express.static('public'));
userApp.route('/_users/*').all(proxy(configuration.users || 'localhost:5984'));

var app = express();
app.use(vhost('auth.*', userApp));

app.use(function(requestIn, responseOut, next) {
var context = {
requestIn: requestIn,
Expand Down
5 changes: 5 additions & 0 deletions conf/config.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ module.exports = {
*/
//port: 80,

/**
* CouchDB service hosting _users database.
*/
//users: 'localhost:5984',

sites: [{

/**
Expand Down
1 change: 0 additions & 1 deletion db/_id

This file was deleted.

3 changes: 0 additions & 3 deletions db/couchapp.json

This file was deleted.

7 changes: 0 additions & 7 deletions db/rewrites.json

This file was deleted.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"version": "1.2015.0430",
"dependencies": {
"express": ">=4.9",
"vhost": ">=2.0",
"express-http-proxy": ">=0.6",
"ldapjs": ">=0.7.x",
"winston": ">=0.8.x",
"async": ">=0.9.x",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9a17934

Please sign in to comment.