mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-20 06:29:53 +01:00
Merge pull request #1135 from marcelklehr/fix/server-restart-settings-reload
/admin/settings: reload settings on server restart
This commit is contained in:
commit
8bb8e484ee
2 changed files with 47 additions and 38 deletions
|
@ -1,5 +1,6 @@
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var eejs = require('ep_etherpad-lite/node/eejs');
|
var eejs = require('ep_etherpad-lite/node/eejs');
|
||||||
|
var settings = require('ep_etherpad-lite/node/utils/Settings');
|
||||||
var installer = require('ep_etherpad-lite/static/js/pluginfw/installer');
|
var installer = require('ep_etherpad-lite/static/js/pluginfw/installer');
|
||||||
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
|
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
@ -44,6 +45,7 @@ exports.socketio = function (hook_name, args, cb) {
|
||||||
|
|
||||||
socket.on("restartServer", function () {
|
socket.on("restartServer", function () {
|
||||||
console.log("Admin request to restart server through a socket on /admin/settings");
|
console.log("Admin request to restart server through a socket on /admin/settings");
|
||||||
|
settings.reloadSettings();
|
||||||
hooks.aCallAll("restartServer", {}, function () {});
|
hooks.aCallAll("restartServer", {}, function () {});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,6 +112,9 @@ exports.abiwordAvailable = function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.reloadSettings = function reloadSettings() {
|
||||||
// Discover where the settings file lives
|
// Discover where the settings file lives
|
||||||
var settingsFilename = argv.settings || "settings.json";
|
var settingsFilename = argv.settings || "settings.json";
|
||||||
settingsFilename = path.resolve(path.join(root, settingsFilename));
|
settingsFilename = path.resolve(path.join(root, settingsFilename));
|
||||||
|
@ -160,3 +163,7 @@ for(var i in settings)
|
||||||
if(exports.dbType === "dirty"){
|
if(exports.dbType === "dirty"){
|
||||||
console.warn("DirtyDB is used. This is fine for testing but not recommended for production.")
|
console.warn("DirtyDB is used. This is fine for testing but not recommended for production.")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// initially load settings
|
||||||
|
exports.reloadSettings();
|
||||||
|
|
Loading…
Reference in a new issue