summaryrefslogtreecommitdiff
path: root/config/http.js
blob: 2901cd92c6af71cf0ad64c6d9db00f810fa1e294 (plain)
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
48
49
var config={
    port:8082,
    apps:{
        
    },
    server:{
        index:'index.html'
    },
    contentType:{
        html: 'text/html',
        css : 'text/css',
        js  : 'text/javascript',
        txt : 'text/plain'
    },
    restrictedType:{
        
    }
}

if(!process.env.SERVER_ROOT){
    console.log('SERVER_ROOT not specified, defaulting to current working dir.')
    process.env.SERVER_ROOT=process.cwd();
}

config.rootDIR=process.env.SERVER_ROOT
console.log('config.rootDIR is '+config.rootDIR);

function prod(){
    console.log('launched as prod');
    config.port=8083;
    return config;
}

function dev(){
    console.log('launched as dev');
    return config;
}

module.exports = function(){
    switch(process.env.NODE_ENV){
        case 'dev':
            return dev();
        case 'prod':
            return prod();
        default:
            console.log('NODE_ENV not specified so defaulting to dev.');
            return dev();
    }
};