From 641121bac6cdefd512a3c4751a97894036c0e196 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Jan 2014 19:58:08 +0100 Subject: go: purge HOSTN and URI_PREFIX --- go/index.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'go/index.js') diff --git a/go/index.js b/go/index.js index 3bac2f7b..e9b551c0 100644 --- a/go/index.js +++ b/go/index.js @@ -1,24 +1,12 @@ // configuration -var hostname = process.env.HOSTN; var httpPort = process.env.PORT; -var uriPrefix = process.env.URI_PREFIX; var redisPrefix = process.env.REDIS_KEY_PREFIX; -var appendDomainToUri = process.env.NOT_SO_SHORT === 'true'; // automatic configuration if (!httpPort) { httpPort = 1337; } -if (!uriPrefix) { - uriPrefix = ''; - if (hostname) { - uriPrefix += 'http://' + hostname; - if (httpPort != 80) { - uriPrefix += ':' + httpPort; - } - } -} if (!redisPrefix) { redisPrefix = 'go:'; } @@ -73,7 +61,7 @@ function create (req, res) { var uri = fields.uri; // TODO check uri(?) var shortPath = '/' + reply; - var shortUri = uriPrefix + shortPath; + var shortUri = 'http://' + req.headers.host + shortPath; var key = redisPrefix + shortPath; redisClient.set(key, uri, function (error) { @@ -81,10 +69,6 @@ function create (req, res) { return internalError(err, req, res); } - if (appendDomainToUri) { - shortUri += '#' + url.parse(uri).host - } - res.writeHead(200, { 'content-type': 'text/plain' }); return res.end(shortUri + '\r\n'); }); -- cgit v1.2.3