2017-12-14 12:03:48 +08:00
|
|
|
"use strict";
|
|
|
|
|
2018-07-23 04:21:16 +08:00
|
|
|
const optionService = require('./options');
|
2018-08-29 03:13:40 +08:00
|
|
|
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);
|
|
|
|
}
|
2017-12-14 12:03:48 +08:00
|
|
|
|
|
|
|
module.exports = {
|
2018-08-29 03:13:40 +08:00
|
|
|
getSyncServerHost: async () => await get('syncServerHost'),
|
|
|
|
isSyncSetup: async () => !!await get('syncServerHost'),
|
|
|
|
getSyncTimeout: async () => await get('syncServerTimeout'),
|
|
|
|
getSyncProxy: async () => await get('syncProxy')
|
2017-12-14 12:03:48 +08:00
|
|
|
};
|