adding args and set_globals

This commit is contained in:
sairajzero 2021-08-30 22:01:42 +05:30
parent c05e260b51
commit 80b9d36287
3 changed files with 60 additions and 0 deletions

9
args/config-sample.json Normal file
View File

@ -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"
}

37
args/param-default.json Normal file
View File

@ -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"
}

14
src/set_globals.js Normal file
View File

@ -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];
}