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" : [{ | ||||
|     "name"        : "zoff", | ||||
|     "script"      : "./app.js", | ||||
|     "script"      : "./server/app.js", | ||||
|     "watch"       : true, | ||||
|     "ignore_watch": ["node_modules", "public/assets/images/thumbnails"], | ||||
|   }] | ||||
| @@ -4,10 +4,7 @@ var cluster = require('cluster'), | ||||
|     //publicPath = path.join(__dirname, 'public'), | ||||
|     http = require('http'), | ||||
|     port = 8080, | ||||
|     num_processes = require('os').cpus().length, | ||||
|     express = require('express'), | ||||
|     vhost = require('vhost'), | ||||
|     app = express(); | ||||
|     num_processes = require('os').cpus().length; | ||||
|  | ||||
| publicPath = path.join(__dirname, 'public'); | ||||
| pathThumbnails = __dirname; | ||||
| @@ -72,41 +69,17 @@ function startSingle(clustered, redis_enabled) { | ||||
|             cert: certificate, | ||||
|             ca: ca | ||||
|         }; | ||||
|  | ||||
|         var https = require('https'); | ||||
|         server = https.Server(credentials, routingFunction); | ||||
|     } catch(err){ | ||||
|         console.log("Starting without https (probably on localhost)"); | ||||
|         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) { | ||||
|         app | ||||
|         .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); | ||||
|         server.listen(onListen); | ||||
|     } else { | ||||
|         app | ||||
|         .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); | ||||
|         server.listen(port, onListen); | ||||
|     } | ||||
|  | ||||
|     var socketIO = client.socketIO; | ||||
| @@ -118,18 +91,14 @@ function startSingle(clustered, redis_enabled) { | ||||
|         } catch(e) { | ||||
|             console.log("No redis-server to connect to.."); | ||||
|         } | ||||
|         socketIO.listen(server); | ||||
|     } else { | ||||
|         socketIO.listen(server); | ||||
|     } | ||||
|  | ||||
|     socketIO.listen(server); | ||||
|  | ||||
|     process.on('message', function(message, connection) { | ||||
|         if (message !== 'sticky-session:connection') { | ||||
|             return; | ||||
|         } | ||||
|         server.emit('connection', connection); | ||||
|  | ||||
|         connection.resume(); | ||||
|     }); | ||||
| } | ||||
|   | ||||
| @@ -24,7 +24,7 @@ var session = require('express-session'); | ||||
| var api = require(pathThumbnails + '/routing/admin/api.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); | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| var mongo_config = { | ||||
|     config: 'mydb', | ||||
|     secret: "secret", | ||||
|     secret: 'secret', | ||||
|     users: 'users', | ||||
|     host: 'localhost', | ||||
| }; | ||||
|  | ||||
| module.exports = mongo_config; | ||||
|   | ||||
| @@ -7,7 +7,7 @@ try { | ||||
|     process.exit(); | ||||
| } | ||||
| 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 }); | ||||
|  | ||||
|   | ||||
| @@ -23,8 +23,6 @@ try { | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| router.use(recaptcha.middleware.render, function(req, res, next) { | ||||
|     next(); // make sure we go to the next routes and don't stop here | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user