From 80b9d36287ece90570b54b60c16d439cdadc1572 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Mon, 30 Aug 2021 22:01:42 +0530 Subject: [PATCH] adding args and set_globals --- args/config-sample.json | 9 +++++++++ args/param-default.json | 37 +++++++++++++++++++++++++++++++++++++ src/set_globals.js | 14 ++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 args/config-sample.json create mode 100644 args/param-default.json create mode 100644 src/set_globals.js diff --git a/args/config-sample.json b/args/config-sample.json new file mode 100644 index 0000000..cb7d5b6 --- /dev/null +++ b/args/config-sample.json @@ -0,0 +1,9 @@ +{ + "secret": "Secret_For_Session__Enter_A_Strong_String(Text/Password)", + "port": "8080", + + "sql_user": "mySQL_user", + "sql_pwd": "mySQL_password", + "sql_db": "supernode", + "sql_host": "localhost" +} \ No newline at end of file diff --git a/args/param-default.json b/args/param-default.json new file mode 100644 index 0000000..6476705 --- /dev/null +++ b/args/param-default.json @@ -0,0 +1,37 @@ +{ + "screen": { + "height": 1160, + "width": 2000, + "colorDepth": 24, + "availHeight": 1080, + "availWidth": 1920, + "pixelDepth": 24 + }, + "navigator": { + "userAgent": "Node/14.17.3 (Linux; aarch64; arm)", + "plugins": [{ + "name": "MySQL", + "filename": "mysql", + "description": "A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed." + }, { + "name": "WebSocket", + "filename": "ws", + "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js" + }, { + "name": "Node fetch", + "filename": "node-fetch", + "description": "A light-weight module that brings window.fetch to node.js" + }], + "mimeTypes": [{ + "description": "", + "type": "application/pdf", + "suffixes": "pdf" + }], + "cookieEnabled": true, + "language": "en-US" + }, + "history": { + "length": 512 + }, + "location": "protocol://subdomain.example.domain/path" +} \ No newline at end of file diff --git a/src/set_globals.js b/src/set_globals.js new file mode 100644 index 0000000..b743c93 --- /dev/null +++ b/src/set_globals.js @@ -0,0 +1,14 @@ +'use strict'; +//fetch for node js (used in floBlockchainAPI.js) +global.fetch = require("node-fetch"); + +//Set browser paramaters from param.json (or param-default.json) +var param; +try { + param = require('../args/param.json'); +} catch { + param = require('../args/param-default.json'); +} finally { + for (let p in param) + global[p] = param[p]; +} \ No newline at end of file