forked from ether/etherpad-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/Pita/etherpad-lite into …
…develop
- Loading branch information
Showing
5 changed files
with
85 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks"); | ||
var express = require('express'); | ||
var settings = require('../utils/Settings'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var _ = require("underscore"); | ||
|
||
var server; | ||
var serverName; | ||
|
||
exports.createServer = function () { | ||
//try to get the git version | ||
var version = ""; | ||
try | ||
{ | ||
var rootPath = path.resolve(npm.dir, '..'); | ||
var ref = fs.readFileSync(rootPath + "/.git/HEAD", "utf-8"); | ||
var refPath = rootPath + "/.git/" + ref.substring(5, ref.indexOf("\n")); | ||
version = fs.readFileSync(refPath, "utf-8"); | ||
version = version.substring(0, 7); | ||
console.log("Your Etherpad Lite git version is " + version); | ||
} | ||
catch(e) | ||
{ | ||
console.warn("Can't get git version for server header\n" + e.message) | ||
} | ||
console.log("Report bugs at https://github.com/Pita/etherpad-lite/issues") | ||
|
||
serverName = "Etherpad-Lite " + version + " (http://j.mp/ep-lite)"; | ||
|
||
exports.restartServer(); | ||
|
||
console.log("You can access your Etherpad-Lite instance at http://" + settings.ip + ":" + settings.port + "/"); | ||
if(!_.isEmpty(settings.users)){ | ||
console.log("The plugin admin page is at http://" + settings.ip + ":" + settings.port + "/admin/plugins"); | ||
} | ||
else{ | ||
console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json"); | ||
} | ||
|
||
} | ||
|
||
exports.restartServer = function () { | ||
if (server) { | ||
console.log("Restarting express server"); | ||
server.close(); | ||
} | ||
|
||
server = express.createServer(); | ||
|
||
server.use(function (req, res, next) { | ||
res.header("Server", serverName); | ||
next(); | ||
}); | ||
|
||
server.configure(function() { | ||
hooks.callAll("expressConfigure", {"app": server}); | ||
}); | ||
hooks.callAll("expressCreateServer", {"app": server}); | ||
|
||
server.listen(settings.port, settings.ip); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters