diff --git a/addon_files/redmatic/etc/default-settings.json b/addon_files/redmatic/etc/default-settings.json index 6c5d3469..72129a87 100644 --- a/addon_files/redmatic/etc/default-settings.json +++ b/addon_files/redmatic/etc/default-settings.json @@ -20,8 +20,10 @@ }, "file": { "module": "localfilesystem", - "dir": "/usr/local/addons/redmatic/var", - "flushInterval": 30 + "config": { + "dir": "/usr/local/addons/redmatic/var", + "flushInterval": 30 + } } }, "editorTheme": { diff --git a/addon_files/redmatic/lib/settings.js b/addon_files/redmatic/lib/settings.js index d8079a9a..6bae5c69 100644 --- a/addon_files/redmatic/lib/settings.js +++ b/addon_files/redmatic/lib/settings.js @@ -64,8 +64,10 @@ if (!settings.contextStorage.memory) { if (!settings.contextStorage.file) { settings.contextStorage.file = { 'module': 'localfilesystem', - dir: '/usr/local/addons/redmatic/var', - flushInterval: 30 + config: { + dir: '/usr/local/addons/redmatic/var', + flushInterval: 30 + } } } @@ -73,8 +75,12 @@ const defaultContextStorage = Object.assign({}, settings.contextStorage[settings delete settings.contextStorage[settings.contextStorage.default.module]; settings.contextStorage.default = defaultContextStorage; -module.exports = Object.assign( +const result = Object.assign( defaults, settings, logging ); + +fs.writeFileSync('/tmp/red-settings.json', JSON.stringify(result)); + +module.exports = result; diff --git a/addon_files/redmatic/www/js/script.js b/addon_files/redmatic/www/js/script.js index b9db0259..efbfc711 100644 --- a/addon_files/redmatic/www/js/script.js +++ b/addon_files/redmatic/www/js/script.js @@ -208,10 +208,15 @@ $(document).ready(() => { } if (!config.contextStorage.file) { config.contextStorage.file = { - 'module': 'localfilesystem', + 'module': 'localfilesystem' + }; + } + + if (!config.contextStorage.file.config) { + config.contextStorage.file.config = { dir: '/usr/local/addons/redmatic/var', flushInterval: 30 - }; + } } if (!config.editorTheme) { @@ -239,8 +244,8 @@ $(document).ready(() => { $contextStorageDefault.val(config.contextStorage.default.module); - $contextStorageFilePath.val(config.contextStorage.file.dir); - $contextStorageFileInterval.val(config.contextStorage.file.flushInterval); + $contextStorageFilePath.val(config.contextStorage.file.config.dir); + $contextStorageFileInterval.val(config.contextStorage.file.config.flushInterval); $('#autorestart').find('option[value="' + config.restartOnCrash + '"]').attr('selected', true); @@ -287,6 +292,16 @@ $(document).ready(() => { save(); }); + $contextStorageFilePath.change(() => { + config.contextStorage.file.config.dir = $contextStorageFilePath.val(); + save(); + }); + + $contextStorageFileInterval.change(() => { + config.contextStorage.file.config.flushInterval = parseInt($contextStorageFileInterval.val(), 10); + save(); + }); + $adminauthSessionExpiryTime.change(() => { if (!config.adminAuth) { config.adminAuth = {};