From bf692f05a7612fe71bf58ad09b50bec879f86761 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 25 Dec 2022 22:50:31 +0530 Subject: [PATCH] Update README --- README.md | 52 ++++++++++++++++++------------------- setup/configure-settings.js | 4 +-- setup/help.js | 12 +++++++-- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 7490496..c164451 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@ # SuperNode Storage ## Installation + ### Pre-requisite -- [X] Nodejs `version >= 12.9` -- [X] MySQL Server +- [X] Nodejs `version >= 12.9` (`--lts` recommended) +- [X] MySQL Server `version > 8.0` ### Download Download the repository using git: @@ -18,45 +19,44 @@ Install using npm: cd SuperNodeStorage npm install ``` +Finish the configuration when prompted ### Configuration #### General Configuration -In `args/` directory, Copy `config-sample.json` to `config.json`. +If not finished during installation, or to re-configure use: ``` -cp args/config-sample.json args/config.json +npm run configure ``` -Edit the values in `args/config.json` as required. -``` -{ -"privateKey": "", -"port": "", - -"sql_user": "", -"sql_pwd": "", -"sql_db": "", -"sql_host": "" -} -``` -- **private-key**: Private key of the node - **port**: Port of the server to run on -- **MySQL-username**: Username for MySQL -- **MySQL-password**: Password for MySQL -- **database-name**: Database in which the data should be stored (default: ***supernode***) -- **sql-host**: Host of the MySQL server (default: ***localhost***). +- **MySQL host**: Host of the MySQL server (default: ***localhost***) +- **Database name**: Database in which the data should be stored (``) (default: ***supernode***) +- **MySQL username**: Username for MySQL (``) +- **MySQL password**: Password for MySQL (``) ***Recommended*** *(optional)* Create and use a MySQL user instead of root. Remember to give access to the database to the user. -#### Parameter Generation *(Optional)* -Open `args/gen-param.html` in a browser and download `param.json` to `SuperNodeStorage/args` directory. +#### Set/Reset Node key password +If not set during installation, or to reset password, use: +``` +npm run reset-password +``` +- **private key**: Private key of the node +- **password**: Password to set for the node (``) -*Note: `param.json` is used for controlled random values used by SecureRandom in Cryptography. If this step is skipped, `param-default.json` will be used as default parameter* +**Note**: Private key of the node is encrypted using the ``. Thus use a ***strong*** password. + +### More +For help or list of all commands, use +``` +npm run help +``` ## Starting the Server After successful installation and configuration using the above steps, SuperNodeStorage can be started using: ``` -npm start +npm start -- -PASSWORD= ``` ## -For more detailed Installation, check the wiki [here](https://github.com/ranchimall/SuperNodeStorage/wiki). +For more information and detailed installation, check the wiki [here](https://github.com/ranchimall/SuperNodeStorage/wiki). diff --git a/setup/configure-settings.js b/setup/configure-settings.js index 7ce7df2..24c33dc 100644 --- a/setup/configure-settings.js +++ b/setup/configure-settings.js @@ -43,13 +43,13 @@ function configureSQL() { flaggedYesOrNo('Do you want to re-configure mySQL connection').then(value => { if (value) { console.log('Enter mySQL connection values: ') - getInput.Text('Host', config['sql_host']).then(host => { + getInput.Text('MySQL host', config['sql_host']).then(host => { config['sql_host'] = host; getInput.Text('Database name', config['sql_db']).then(dbname => { config['sql_db'] = dbname; getInput.Text('MySQL username', config['sql_user']).then(sql_user => { config['sql_user'] = sql_user; - getInput.Text('Mysql password', config['sql_pwd']).then(sql_pwd => { + getInput.Text('MySQL password', config['sql_pwd']).then(sql_pwd => { config['sql_pwd'] = sql_pwd; resolve(true); }) diff --git a/setup/help.js b/setup/help.js index 9ba1c3d..5db9015 100644 --- a/setup/help.js +++ b/setup/help.js @@ -1,13 +1,19 @@ let message = ` SuperNode Storage ------------------ +================= +Setup +----- npm install - Install the app and node modules. npm run help - List all commands. npm run setup - Finish the setup (configure and reset password). npm run configure - Configure the app. npm run reset-password - Reset the password (for private-key). +(Optional) Open args/gen-param.html and Download param.json to args/ directory + +Start Node +---------- npm start - Start the application (main). NOTE: argument 'PASSWORD' required for 'npm start' @@ -16,7 +22,9 @@ npm start -- -PASSWORD= (Optional) 'console.debug' is now turned off by default. pass argument '--debug' to turn it on npm start -- -PASSWORD= --debug -(Optional) Open args/gen-param.html and Download param.json to args/ directory +Debugging +--------- +npm run checksum-db - List the stored node tables and checksum `; console.log(message); \ No newline at end of file