mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Blue Turtle - The Refactoring
This commit is contained in:
parent
04011678fb
commit
b7d08eb500
67 changed files with 11651 additions and 8452 deletions
35
libs/webServer.js
Normal file
35
libs/webServer.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
var fs = require('fs');
|
||||
var http = require('http');
|
||||
var https = require('https');
|
||||
var express = require('express');
|
||||
var app = express()
|
||||
module.exports = function(s,config,lang,io){
|
||||
var server = http.createServer(app);
|
||||
//SSL options
|
||||
if(config.ssl&&config.ssl.key&&config.ssl.cert){
|
||||
config.ssl.key=fs.readFileSync(s.checkRelativePath(config.ssl.key),'utf8')
|
||||
config.ssl.cert=fs.readFileSync(s.checkRelativePath(config.ssl.cert),'utf8')
|
||||
if(config.ssl.port === undefined){
|
||||
config.ssl.port=443
|
||||
}
|
||||
if(config.ssl.bindip === undefined){
|
||||
config.ssl.bindip=config.bindip
|
||||
}
|
||||
if(config.ssl.ca&&config.ssl.ca instanceof Array){
|
||||
config.ssl.ca.forEach(function(v,n){
|
||||
config.ssl.ca[n]=fs.readFileSync(s.checkRelativePath(v),'utf8')
|
||||
})
|
||||
}
|
||||
var serverHTTPS = https.createServer(config.ssl,app);
|
||||
serverHTTPS.listen(config.ssl.port,config.bindip,function(){
|
||||
console.log('SSL '+lang.Shinobi+' : SSL Web Server Listening on '+config.ssl.port);
|
||||
});
|
||||
io.attach(serverHTTPS);
|
||||
}
|
||||
//start HTTP
|
||||
server.listen(config.port,config.bindip,function(){
|
||||
console.log(lang.Shinobi+' : Web Server Listening on '+config.port);
|
||||
});
|
||||
io.attach(server);
|
||||
return app
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue