-
Notifications
You must be signed in to change notification settings - Fork 8
/
config.js
47 lines (41 loc) · 1.38 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var express = require('express')
, connect = require('connect')
, mongoose = require('mongoose')
, mongoURI = process.env['MONGO_URI'] || 'mongodb://localhost/github'
, db = mongoose.connect(mongoURI);
try {
var keys = require('./keys');
} catch(e) {}
module.exports = function(app){
app.configure(function(){
var githubToken = process.env.GITHUB_TOKEN || keys.githubToken;
app.set('githubToken', githubToken);
this
.use(express.bodyParser())
.set('public', __dirname + '/public')
.enable('jsonp callback')
.enable('error templates')
.use(express.static(__dirname + '/public'))
.set('db', db);
});
// Dev
app.configure('development', function(){
this
.use(express.cookieParser())
.use(express.session({ secret: "pwn noobs"}))
.use(express.logger('\x1b[90m:remote-addr -\x1b[0m \x1b[33m:method\x1b[0m' +
'\x1b[32m:url\x1b[0m :status \x1b[90m:response-time ms\x1b[0m'))
.use(express.errorHandler({dumpExceptions: true, showStack: true}))
.enable('dev')
.set('domain', 'app.local');
});
// Prod
app.configure('production', function(){
this
.use(express.logger({buffer: 10000}))
.use(connect.cookieParser('tiutiuti454545utiutiut'))
.use(express.errorHandler({dumpExceptions: true, showStack: true}))
.enable('prod')
.set('domain', 'social.bn.ee');
});
}