Skip to content
Snippets Groups Projects
Commit 0b0554de authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #976 Bug on Duniter UI button "Reset data"

parent d15cd25d
No related branches found
No related tags found
No related merge requests found
......@@ -188,24 +188,26 @@ function Stack(dependencies) {
// Initialize server (db connection, ...)
try {
yield server.plugFileSystem();
server.onPluggedFSHook = () => co(function*() {
// Register the configuration hook for loading phase (overrides the loaded data)
server.dal.loadConfHook = (conf) => co(function*() {
// Loading injection
for (const callback of configLoadingCallbacks) {
yield callback(conf, program, logger, server.dal.confDAL);
}
});
// Register the configuration hook for loading phase (overrides the loaded data)
server.dal.loadConfHook = (conf) => co(function*() {
// Loading injection
for (const callback of configLoadingCallbacks) {
yield callback(conf, program, logger, server.dal.confDAL);
}
});
// Register the configuration hook for saving phase (overrides the saved data)
server.dal.saveConfHook = (conf) => co(function*() {
const clonedConf = _.clone(conf);
for (const callback of configBeforeSaveCallbacks) {
yield callback(clonedConf, program, logger, server.dal.confDAL);
}
return clonedConf;
});
// Register the configuration hook for saving phase (overrides the saved data)
server.dal.saveConfHook = (conf) => co(function*() {
const clonedConf = _.clone(conf);
for (const callback of configBeforeSaveCallbacks) {
yield callback(clonedConf, program, logger, server.dal.confDAL);
}
return clonedConf;
});
})
yield server.plugFileSystem();
const conf = yield server.loadConf();
......
......@@ -90,6 +90,7 @@ function Server (home, memoryOnly, overrideConf) {
logger.debug('Plugging file system...');
const params = yield paramsP;
that.dal = fileDAL(params);
yield that.onPluggedFSHook()
});
this.unplugFileSystem = () => co(function *() {
......@@ -453,6 +454,11 @@ function Server (home, memoryOnly, overrideConf) {
* Default WoT transforming method for certs => links. To be overriden by a module.
*/
this.generatorNewCertsToLinks = () => Promise.resolve({})
/*
* Default hook on file system plugging. To be overriden by module system.
*/
this.onPluggedFSHook = () => Promise.resolve({})
}
util.inherits(Server, stream.Duplex);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment