Skip to content

Commit

Permalink
cleaned up pathing
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismatthieu committed Feb 13, 2011
1 parent 729c1c1 commit cad9a91
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ http://nodester.com
var express = require('express'),
url = require('url'),
sys = require('sys'),
config = require("./config"),
config = require('./config'),
middle = require('./lib/middle');

process.on('uncaughtException', function (err) {
Expand Down
1 change: 1 addition & 0 deletions deps/nodemon
Submodule nodemon added at 173832
24 changes: 14 additions & 10 deletions lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var get_couchdb_connection = function () {
return new cradle.Connection({
host: config.opt.couch_host,
port: config.opt.couch_port,
auth: {user: config.opt.couch_user, pass: config.opt.couch_pass},
auth: {username: config.opt.couch_user, password: config.opt.couch_pass},
options: {cache: false, raw: false}
});
};
Expand Down Expand Up @@ -63,15 +63,19 @@ var build_proxytable_map = function (cb) {
var aliasdomains = conn.database(exports.couch_prefix + "aliasdomains");
var proxy_map = default_routes;
apps.view('nodeapps/all', function (err, resp) {
resp.forEach(function (row) {
proxy_map.router[row._id + "." + config.opt.tl_dom] = "127.0.0.1:" + row.port;
});
aliasdomains.view('aliasdomains/all', function (err, resp) {
resp.forEach(function (row) {
proxy_map.router[row._id] = row.host + ":" + row.port;
});
cb(proxy_map);
});
if (err) {

} else {
resp.forEach(function (row) {
proxy_map.router[row._id + "." + config.opt.tl_dom] = "127.0.0.1:" + row.port;
});
aliasdomains.view('aliasdomains/all', function (err, resp) {
resp.forEach(function (row) {
proxy_map.router[row._id] = row.host + ":" + row.port;
});
cb(proxy_map);
});
}
});
};
exports.build_proxytable_map = build_proxytable_map;
Expand Down
5 changes: 2 additions & 3 deletions lib/middle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var lib = require('./lib'),
cradle = require('cradle'),
config = require('./config');

config = require('../config');

/**
* Dynamic express route to authenticate a user from CouchDB
Expand All @@ -11,7 +10,7 @@ var authenticate = function(req, res, next) {

if (typeof basicauth != 'undefined' && basicauth.length > 0) {
var buff = new Buffer(basicauth.substring(basicauth.indexOf(" ") + 1 ), encoding='base64');
var creds = buff.toString('ascii')
var creds = buff.toString('ascii');

var username = creds.substring(0,creds.indexOf(":"));
var password = creds.substring(creds.indexOf(":") + 1);
Expand Down
2 changes: 1 addition & 1 deletion public/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<h3>Did you get your coupon code? <a href="#" onclick="tb_remove()">I wish!</a></p></h3>
<fieldset>

<form action="http://nodester.com/user" method="post">
<form action="/user" method="post">
<p><label for="name">Coupon:</label>
<input type="password" name="coupon" id="coupon" value="" /><br />
<label for="name">Username:</label>
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<h3>Did you get your coupon code? <a href="#" onclick="tb_remove()">I wish!</a></p></h3>
<fieldset>

<form action="http://www.nodester.com/user" method="post">
<form action="/user" method="post">
<p><label for="name">Coupon:</label>
<input type="password" name="coupon" id="coupon" value="" /><br />
<label for="name">Username:</label>
Expand Down

0 comments on commit cad9a91

Please sign in to comment.