Search fixes #125, faster lazy-load image, detects localhost

This commit is contained in:
Nicolas A. Tonne
2015-07-08 22:23:31 +02:00
parent d85f59996a
commit eb53955a6b
7 changed files with 17 additions and 19 deletions

View File

@@ -1,18 +1,6 @@
var server;
/******
This if for the localhost running
******/
localhost = false;
//https server
if(localhost)
{
var http = require('http');
server = http.createServer(app);
}else
{
try{
var fs = require('fs');
var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8');
var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8');
@@ -20,6 +8,13 @@ if(localhost)
var https = require('https');
server = https.createServer(credentials, app);
}
catch(err){
console.log("Starting without https (probably on localhost)");
if(err["errno"] != 34)console.log(err);
var http = require('http');
server = http.createServer(app);
}
var express = require('express');
var app = express();