mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Moved files, and shortened some
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"apps" : [{
|
"apps" : [{
|
||||||
"name" : "zoff",
|
"name" : "zoff",
|
||||||
"script" : "./app.js",
|
"script" : "./server/app.js",
|
||||||
"watch" : true,
|
"watch" : true,
|
||||||
"ignore_watch": ["node_modules", "public/assets/images/thumbnails"],
|
"ignore_watch": ["node_modules", "public/assets/images/thumbnails"],
|
||||||
}]
|
}]
|
||||||
@@ -4,10 +4,7 @@ var cluster = require('cluster'),
|
|||||||
//publicPath = path.join(__dirname, 'public'),
|
//publicPath = path.join(__dirname, 'public'),
|
||||||
http = require('http'),
|
http = require('http'),
|
||||||
port = 8080,
|
port = 8080,
|
||||||
num_processes = require('os').cpus().length,
|
num_processes = require('os').cpus().length;
|
||||||
express = require('express'),
|
|
||||||
vhost = require('vhost'),
|
|
||||||
app = express();
|
|
||||||
|
|
||||||
publicPath = path.join(__dirname, 'public');
|
publicPath = path.join(__dirname, 'public');
|
||||||
pathThumbnails = __dirname;
|
pathThumbnails = __dirname;
|
||||||
@@ -72,41 +69,17 @@ function startSingle(clustered, redis_enabled) {
|
|||||||
cert: certificate,
|
cert: certificate,
|
||||||
ca: ca
|
ca: ca
|
||||||
};
|
};
|
||||||
|
|
||||||
var https = require('https');
|
var https = require('https');
|
||||||
server = https.Server(credentials, routingFunction);
|
server = https.Server(credentials, routingFunction);
|
||||||
} catch(err){
|
} catch(err){
|
||||||
console.log("Starting without https (probably on localhost)");
|
console.log("Starting without https (probably on localhost)");
|
||||||
server = http.createServer(routingFunction);
|
server = http.createServer(routingFunction);
|
||||||
//add = ",http://localhost:80*,http://localhost:8080*,localhost:8080*, localhost:8082*,http://zoff.dev:80*,http://zoff.dev:8080*,zoff.dev:8080*, zoff.dev:8082*";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(clustered) {
|
if(clustered) {
|
||||||
app
|
server.listen(onListen);
|
||||||
.use( vhost('*', function(req, res) {
|
|
||||||
server.emit("request", req, res);
|
|
||||||
}) )
|
|
||||||
.use( vhost('remote.*', function(req, res) {
|
|
||||||
server.emit("request", req, res);
|
|
||||||
}) )
|
|
||||||
.use( vhost('admin.*', function(req, res) {
|
|
||||||
server.emit("request", req, res);
|
|
||||||
}) )
|
|
||||||
.listen(onListen);
|
|
||||||
//server.listen(onListen);
|
|
||||||
} else {
|
} else {
|
||||||
app
|
server.listen(port, onListen);
|
||||||
.use( vhost('*', function(req, res) {
|
|
||||||
server.emit("request", req, res);
|
|
||||||
}) )
|
|
||||||
.use( vhost('remote.*', function(req, res) {
|
|
||||||
server.emit("request", req, res);
|
|
||||||
}) )
|
|
||||||
.use( vhost('admin.*', function(req, res) {
|
|
||||||
server.emit("request", req, res);
|
|
||||||
}) )
|
|
||||||
.listen(port, onListen);
|
|
||||||
//server.listen(port, onListen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var socketIO = client.socketIO;
|
var socketIO = client.socketIO;
|
||||||
@@ -118,18 +91,14 @@ function startSingle(clustered, redis_enabled) {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log("No redis-server to connect to..");
|
console.log("No redis-server to connect to..");
|
||||||
}
|
}
|
||||||
socketIO.listen(server);
|
|
||||||
} else {
|
|
||||||
socketIO.listen(server);
|
|
||||||
}
|
}
|
||||||
|
socketIO.listen(server);
|
||||||
|
|
||||||
process.on('message', function(message, connection) {
|
process.on('message', function(message, connection) {
|
||||||
if (message !== 'sticky-session:connection') {
|
if (message !== 'sticky-session:connection') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
server.emit('connection', connection);
|
server.emit('connection', connection);
|
||||||
|
|
||||||
connection.resume();
|
connection.resume();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ var session = require('express-session');
|
|||||||
var api = require(pathThumbnails + '/routing/admin/api.js');
|
var api = require(pathThumbnails + '/routing/admin/api.js');
|
||||||
|
|
||||||
var User = require(pathThumbnails + '/models/user.js');
|
var User = require(pathThumbnails + '/models/user.js');
|
||||||
var url = 'mongodb://localhost/users';
|
var url = 'mongodb://' + mongo_db_cred.host + '/' + mongo_db_cred.user;
|
||||||
mongoose.connect(url);
|
mongoose.connect(url);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
var mongo_config = {
|
var mongo_config = {
|
||||||
config: 'mydb',
|
config: 'mydb',
|
||||||
secret: "secret",
|
secret: 'secret',
|
||||||
|
users: 'users',
|
||||||
|
host: 'localhost',
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = mongo_config;
|
module.exports = mongo_config;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ try {
|
|||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
var mongojs = require('mongojs');
|
var mongojs = require('mongojs');
|
||||||
var db = mongojs(mongo_config.config);
|
var db = mongojs('mongodb://' + mongo_config.host + '/' + mongo_config.config);
|
||||||
|
|
||||||
db.collection("chat_logs").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 600 });
|
db.collection("chat_logs").createIndex({ "createdAt": 1 }, { expireAfterSeconds: 600 });
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
router.use(recaptcha.middleware.render, function(req, res, next) {
|
router.use(recaptcha.middleware.render, function(req, res, next) {
|
||||||
next(); // make sure we go to the next routes and don't stop here
|
next(); // make sure we go to the next routes and don't stop here
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user