mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
overriding sync settings from config file, fixes #160
This commit is contained in:
parent
7ae2a24770
commit
de4ace5ada
@ -1,10 +1,22 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const optionService = require('./options');
|
const optionService = require('./options');
|
||||||
|
const config = require('./config');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Primary configuration for sync is in the options (document), but we allow to override
|
||||||
|
* these settings in config file. The reason for that is to avoid a mistake of loading a live/production
|
||||||
|
* document with live sync settings in a dev/debug environment. Changes would then successfully propagate
|
||||||
|
* to live sync server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function get(name) {
|
||||||
|
return config['Sync'][name] || await optionService.getOption(name);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getSyncServerHost: async () => await optionService.getOption('syncServerHost'),
|
getSyncServerHost: async () => await get('syncServerHost'),
|
||||||
isSyncSetup: async () => !!await optionService.getOption('syncServerHost'),
|
isSyncSetup: async () => !!await get('syncServerHost'),
|
||||||
getSyncTimeout: async () => await optionService.getOption('syncServerTimeout'),
|
getSyncTimeout: async () => await get('syncServerTimeout'),
|
||||||
getSyncProxy: async () => await optionService.getOption('syncProxy')
|
getSyncProxy: async () => await get('syncProxy')
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user