summaryrefslogtreecommitdiffstats
path: root/go/index.js
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-01-06 01:38:37 +0100
committertv <tv@nomic.retiolum>2014-01-06 01:38:37 +0100
commit7023ea2453bde5a09ffd2555c4237443ad88b643 (patch)
treed4a58459876213df55ba9d888bc5b5cde95ab8bc /go/index.js
parent1915e77f5d97f9a2816c447e3051d63d18a8b71d (diff)
go: make URI_PREFIX configurable
Diffstat (limited to 'go/index.js')
-rw-r--r--go/index.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/go/index.js b/go/index.js
index 16b6df98..44ff79b5 100644
--- a/go/index.js
+++ b/go/index.js
@@ -1,15 +1,21 @@
-// configuration (and defaults)
+// configuration
var hostname = process.env.HOSTN;
-var httpPort = process.env.PORT || 1337;
+var httpPort = process.env.PORT;
+var uriPrefix = process.env.URI_PREFIX;
var redisPrefix = 'go:';
// automatic configuration
-var uriPrefix = '';
-if (hostname) {
- uriPrefix += 'http://' + hostname;
- if (httpPort != 80) {
- uriPrefix += ':' + httpPort;
+if (!httpPort) {
+ httpPort = 1337;
+}
+if (!uriPrefix) {
+ uriPrefix = '';
+ if (hostname) {
+ uriPrefix += 'http://' + hostname;
+ if (httpPort != 80) {
+ uriPrefix += ':' + httpPort;
+ }
}
}