From 67d1aa4e4f814713ef8837b60e7ee9d5c7f96fb0 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Wed, 23 Aug 2017 15:39:59 +0300 Subject: [PATCH] app settings schema --- main.js | 21 ++++---- routes/shepherd.js | 121 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 130 insertions(+), 12 deletions(-) diff --git a/main.js b/main.js index 49a80a2..7912a5b 100644 --- a/main.js +++ b/main.js @@ -337,6 +337,7 @@ function createWindow(status) { if (appConfig.v2) { shepherd.writeLog('show edex gui'); mainWindow.appConfig = appConfig; + mainWindow.appConfigSchema = shepherd.appConfigSchema; mainWindow.appBasicInfo = appBasicInfo; mainWindow.appSessionHash = appSessionHash; mainWindow.assetChainPorts = require('./routes/ports.js'); @@ -545,16 +546,16 @@ function formatBytes(bytes, decimals) { const k = 1000; const dm = decimals + 1 || 3; const sizes = [ - 'Bytes', - 'KB', - 'MB', - 'GB', - 'TB', - 'PB', - 'EB', - 'ZB', - 'YB' - ]; + 'Bytes', + 'KB', + 'MB', + 'GB', + 'TB', + 'PB', + 'EB', + 'ZB', + 'YB' + ]; const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; diff --git a/routes/shepherd.js b/routes/shepherd.js index 329ed40..7455036 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -96,7 +96,7 @@ shepherd.appConfig = { iguanaCorePort: 7778, maxDescriptors: { darwin: 90000, - linux: 1000000 + linux: 1000000, }, killIguanaOnStart: true, dev: false, @@ -105,12 +105,129 @@ shepherd.appConfig = { debug: false, cli: { passthru: true, - default: true + default: true, }, iguanaLessMode: true, roundValues: false, }; +shepherd.appConfigSchema = { + edexGuiOnly: { + display: false, + type: 'boolean', + displayName: 'EDEX GUI only', + }, + iguanaGuiOnly: { + display: false, + type: 'boolean', + displayName: 'Iguana GUI only', + }, + manualIguanaStart: { + display: false, + type: 'boolean', + displayName: 'Manual Iguana Start', + }, + skipBasiliskNetworkCheck: { + display: false, + type: 'boolean', + displayName: 'Skip Basilisk Network Check', + }, + minNotaries: { + display: false, + type: 'number', + displayName: 'Minimum notaries count', + info: 'Minimum number of notaries to connect to on startup', + }, + host: { + display: true, + type: 'string', + displayName: 'Hostname', + info: 'Application hostname', + }, + agamaPort: { + display: true, + type: 'number', + displayName: 'Agama Port', + info: 'Agama HTTP port. Required to run GUI.', + }, + iguanaCorePort: { + display: true, + type: 'number', + displayName: 'Iguana Core Port', + info: 'Default Iguana Core Port. Change it if you have conflicts with other applications.', + }, + maxDescriptors: { + display: false, + displayName: 'Max Descriptors per Process', + darwin: { + display: true, + displayName: 'MacOS (Darwin)', + type: 'number', + }, + linux: { + display: true, + displayName: 'Linux', + type: 'number', + }, + }, + killIguanaOnStart: { + display: true, + displayName: 'Kill Iguana Core Processes on Startup', + info: 'Kill any rogue Iguana Core processes during app startup', + type: 'boolean', + }, + dev: { + display: true, + displayName: 'Developer mode', + info: 'Enable developer mode.', + type: 'boolean', + }, + v2: { + display: false, + type: 'boolean', + }, + useBasiliskInstance: { + display: true, + displayName: 'Iguana Core Basilisk Instance', + info: 'Enable dedicated Iguana Core instance to handle all Basilisk network requests', + type: 'boolean', + }, + debug: { + display: true, + displayName: 'Debug', + info: 'Enable debug output', + type: 'boolean', + }, + cli: { + display: true, + displayName: 'Direct BitcoinRPC passthru interface', + info: 'Enable direct BitcoinRPC passthru interface. It will bypass Iguana Core and send requests directly to Bitcoin JSON server.', + passthru: { + display: true, + displayName: 'Enable Direct Passthru', + type: 'boolean', + }, + default: { + display: true, + displayName: 'Enable CLI passthru', + info: 'Enable komodo-cli passthru. This allows you to send CLI compatible commands directly from UI to komodo-cli.', + type: 'boolean', + }, + }, + iguanaLessMode: { + display: true, + displayName: 'Enable Native Only mode', + info: 'Limited to only Komodo native mode to speed up loading and reduce hardware resources consumption.', + type: 'boolean', + }, + roundValues: { + display: true, + displayName: 'Enable amount rounding', + info: 'Round \"dust\" amounts to save screen space.', + type: 'boolean', + }, +}; + shepherd.defaultAppConfig = Object.assign({}, shepherd.appConfig); shepherd.coindInstanceRegistry = coindInstanceRegistry;