Compare commits

...

5 Commits

Author SHA1 Message Date
John Crepezzi 32df3370e2 Fix header name 2017-05-02 20:08:03 -04:00
John Crepezzi d81195856a Log ip 2017-05-02 20:08:03 -04:00
John Crepezzi 6ed427658e Remove npm 2017-05-02 20:08:03 -04:00
John Crepezzi 08eddc7e80 Added pg 2017-05-02 20:08:03 -04:00
John Crepezzi d040dedc6e Production uses postgres 2017-05-02 20:07:40 -04:00
3 changed files with 4 additions and 9 deletions

View File

@ -33,10 +33,7 @@
}, },
"storage": { "storage": {
"type": "redis", "type": "postgres",
"host": "0.0.0.0",
"port": 6379,
"db": 2,
"expire": 2592000 "expire": 2592000
}, },

View File

@ -69,7 +69,8 @@ DocumentHandler.prototype.handlePost = function (request, response) {
_this.chooseKey(function (key) { _this.chooseKey(function (key) {
_this.store.set(key, buffer, function (res) { _this.store.set(key, buffer, function (res) {
if (res) { if (res) {
winston.verbose('added document', { key: key }); var ip = request.headers['x-forwarded-for'] || request.ip;
winston.verbose('added document', { key: key, ip: ip });
response.writeHead(200, { 'content-type': 'application/json' }); response.writeHead(200, { 'content-type': 'application/json' });
response.end(JSON.stringify({ key: key })); response.end(JSON.stringify({ key: key }));
} }

View File

@ -19,8 +19,6 @@
"connect": "3.4.1", "connect": "3.4.1",
"st": "1.1.0", "st": "1.1.0",
"winston": "0.6.2", "winston": "0.6.2",
"redis-url": "0.1.0",
"redis": "0.8.1",
"uglify-js": "1.3.3", "uglify-js": "1.3.3",
"busboy": "0.2.4", "busboy": "0.2.4",
"pg": "4.1.1" "pg": "4.1.1"
@ -31,8 +29,7 @@
}, },
"bundledDependencies": [], "bundledDependencies": [],
"engines": { "engines": {
"node": "0.10.35", "node": "0.10.35"
"npm": "1.1.49"
}, },
"bin": { "bin": {
"haste-server": "./server.js" "haste-server": "./server.js"