mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
24 lines
968 B
JavaScript
24 lines
968 B
JavaScript
process.env.rootdir = __dirname;
|
|
var LIVE = process.env.LIVE || (process.env.NODE_ENV === 'production') || process.env.PORT
|
|
, web = require(process.env.COALESCEPATH = LIVE?'coalesce':process.env.rootdir+'/../coalesce/coalesce')
|
|
, opt = {};
|
|
opt.port = !LIVE? 8888 : process.env.PORT? process.env.PORT : 80;
|
|
process.env.domain = LIVE? 'http://gunjs.herokuapp.com' :
|
|
(function(){require('child_process').exec('ifconfig',function(e,r){
|
|
console.log('on',process.env.domain='http://'+ r.match(/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/)[0] +':'+opt.port)
|
|
})})();
|
|
opt.hook = {
|
|
pre: (function(req,res){
|
|
//console.log("--------- "+req.flow+" : "+req.url.pathname +" ---------------");
|
|
})
|
|
};
|
|
|
|
if(LIVE){
|
|
//process.env['redis-install'] = '/tmp';
|
|
}
|
|
|
|
opt.run = ['./test/server', './test/tests'];
|
|
opt.node = {key: "temp gun key", src:["http://gunjs.herokuapp.com/com","http://marknadal.kd.io/com"]};
|
|
|
|
web(opt);
|
|
console.log("Gun @ "+ opt.port); |